<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<title>API: editor   selection.js  (YUI Library)</title>

	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
	<link rel="stylesheet" type="text/css" href="assets/api.css" />

    <script type="text/javascript" src="assets/api-js"></script>
    <script type="text/javascript" src="assets/ac-js"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">
	<div id="hd">
        <h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1>
        <h3>editor&nbsp; <span class="subtitle">3.3.0</span></h3>
        <a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a> 
            &gt; <a href="./module_editor.html" title="editor">editor</a>
                
                 &gt; selection.js (source view) 
        <form onsubmit="return false">
            <div id="propertysearch">
                Search: <input autocomplete="off" id="searchinput" />
                <div id="searchresults">
                    &nbsp;
                </div>
            </div>
        </form>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
                <fieldset>
                    <legend>Filters</legend>
                <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
                <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
                <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
                </fieldset>
            </form>

                    <div id="srcout">
                        <style>
                            #doc3 .classopts { display:none; }
                        </style>
                        <div class="highlight"><pre>    <span class="cm">/**</span>
<span class="cm">     * Wraps some common Selection/Range functionality into a simple object</span>
<span class="cm">     * @module editor</span>
<span class="cm">     * @submodule selection</span>
<span class="cm">     */</span>     
    <span class="cm">/**</span>
<span class="cm">     * Wraps some common Selection/Range functionality into a simple object</span>
<span class="cm">     * @class Selection</span>
<span class="cm">     * @for Selection</span>
<span class="cm">     * @constructor</span>
<span class="cm">     */</span>
    
    <span class="c1">//TODO This shouldn&#39;t be there, Y.Node doesn&#39;t normalize getting textnode content.</span>
    <span class="kd">var</span> <span class="nx">textContent</span> <span class="o">=</span> <span class="s1">&#39;textContent&#39;</span><span class="p">,</span>
    <span class="nx">INNER_HTML</span> <span class="o">=</span> <span class="s1">&#39;innerHTML&#39;</span><span class="p">,</span>
    <span class="nx">FONT_FAMILY</span> <span class="o">=</span> <span class="s1">&#39;fontFamily&#39;</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">UA</span><span class="p">.</span><span class="nx">ie</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">textContent</span> <span class="o">=</span> <span class="s1">&#39;nodeValue&#39;</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">domEvent</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">sel</span><span class="p">,</span> <span class="nx">par</span><span class="p">,</span> <span class="nx">ieNode</span><span class="p">,</span> <span class="nx">nodes</span><span class="p">,</span> <span class="nx">rng</span><span class="p">,</span> <span class="nx">i</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">win</span><span class="p">.</span><span class="nx">getSelection</span><span class="p">)</span> <span class="p">{</span>
	        <span class="nx">sel</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">win</span><span class="p">.</span><span class="nx">getSelection</span><span class="p">();</span>
        <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">selection</span><span class="p">)</span> <span class="p">{</span>
    	    <span class="nx">sel</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">selection</span><span class="p">.</span><span class="nx">createRange</span><span class="p">();</span>
        <span class="p">}</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_selection</span> <span class="o">=</span> <span class="nx">sel</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">pasteHTML</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">isCollapsed</span> <span class="o">=</span> <span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">compareEndPoints</span><span class="p">(</span><span class="s1">&#39;StartToEnd&#39;</span><span class="p">,</span> <span class="nx">sel</span><span class="p">))</span> <span class="o">?</span> <span class="kc">false</span> <span class="o">:</span> <span class="kc">true</span><span class="p">;</span>
            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">isCollapsed</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">anchorNode</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">focusNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">parentElement</span><span class="p">());</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">domEvent</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">ieNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">elementFromPoint</span><span class="p">(</span><span class="nx">domEvent</span><span class="p">.</span><span class="nx">clientX</span><span class="p">,</span> <span class="nx">domEvent</span><span class="p">.</span><span class="nx">clientY</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">ieNode</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">par</span> <span class="o">=</span> <span class="nx">sel</span><span class="p">.</span><span class="nx">parentElement</span><span class="p">();</span>
                    <span class="nx">nodes</span> <span class="o">=</span> <span class="nx">par</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">;</span>
                    <span class="nx">rng</span> <span class="o">=</span> <span class="nx">sel</span><span class="p">.</span><span class="nx">duplicate</span><span class="p">();</span>

                    <span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">nodes</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
                        <span class="c1">//This causes IE to not allow a selection on a doubleclick</span>
                        <span class="c1">//rng.select(nodes[i]);</span>
                        <span class="k">if</span> <span class="p">(</span><span class="nx">rng</span><span class="p">.</span><span class="nx">inRange</span><span class="p">(</span><span class="nx">sel</span><span class="p">))</span> <span class="p">{</span>
                            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">ieNode</span><span class="p">)</span> <span class="p">{</span>
                                <span class="nx">ieNode</span> <span class="o">=</span> <span class="nx">nodes</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
                            <span class="p">}</span>
                        <span class="p">}</span>
                    <span class="p">}</span>
                <span class="p">}</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">ieNode</span> <span class="o">=</span> <span class="nx">ieNode</span><span class="p">;</span>
                
                <span class="k">if</span> <span class="p">(</span><span class="nx">ieNode</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">ieNode</span><span class="p">.</span><span class="nx">nodeType</span> <span class="o">!==</span> <span class="mi">3</span><span class="p">)</span> <span class="p">{</span>
                        <span class="k">if</span> <span class="p">(</span><span class="nx">ieNode</span><span class="p">.</span><span class="nx">firstChild</span><span class="p">)</span> <span class="p">{</span>
                            <span class="nx">ieNode</span> <span class="o">=</span> <span class="nx">ieNode</span><span class="p">.</span><span class="nx">firstChild</span><span class="p">;</span>
                        <span class="p">}</span>
                        <span class="k">if</span> <span class="p">(</span><span class="nx">ieNode</span> <span class="o">&amp;&amp;</span> <span class="nx">ieNode</span><span class="p">.</span><span class="nx">tagName</span> <span class="o">&amp;&amp;</span> <span class="nx">ieNode</span><span class="p">.</span><span class="nx">tagName</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">()</span> <span class="o">===</span> <span class="s1">&#39;body&#39;</span><span class="p">)</span> <span class="p">{</span>
                            <span class="k">if</span> <span class="p">(</span><span class="nx">ieNode</span><span class="p">.</span><span class="nx">firstChild</span><span class="p">)</span> <span class="p">{</span>
                                <span class="nx">ieNode</span> <span class="o">=</span> <span class="nx">ieNode</span><span class="p">.</span><span class="nx">firstChild</span><span class="p">;</span>
                            <span class="p">}</span>
                        <span class="p">}</span>
                    <span class="p">}</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">anchorNode</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">focusNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">resolve</span><span class="p">(</span><span class="nx">ieNode</span><span class="p">);</span>
                    
                    <span class="k">this</span><span class="p">.</span><span class="nx">anchorOffset</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">focusOffset</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">anchorNode</span><span class="p">.</span><span class="nx">nodeValue</span><span class="p">)</span> <span class="o">?</span> <span class="k">this</span><span class="p">.</span><span class="nx">anchorNode</span><span class="p">.</span><span class="nx">nodeValue</span><span class="p">.</span><span class="nx">length</span> <span class="o">:</span> <span class="mi">0</span> <span class="p">;</span>
                    
                    <span class="k">this</span><span class="p">.</span><span class="nx">anchorTextNode</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">focusTextNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">ieNode</span><span class="p">);</span>
                <span class="p">}</span>
                
                
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="c1">//This helps IE deal with a selection and nodeChange events</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">htmlText</span><span class="p">)</span> <span class="p">{</span>
                    <span class="kd">var</span> <span class="nx">n</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">htmlText</span><span class="p">);</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">n</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;id&#39;</span><span class="p">))</span> <span class="p">{</span>
                        <span class="kd">var</span> <span class="nx">id</span> <span class="o">=</span> <span class="nx">n</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;id&#39;</span><span class="p">);</span>
                        <span class="k">this</span><span class="p">.</span><span class="nx">anchorNode</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">focusNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="s1">&#39;#&#39;</span> <span class="o">+</span> <span class="nx">id</span><span class="p">);</span>
                    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                        <span class="nx">n</span> <span class="o">=</span> <span class="nx">n</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;childNodes&#39;</span><span class="p">);</span>
                        <span class="k">this</span><span class="p">.</span><span class="nx">anchorNode</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">focusNode</span> <span class="o">=</span> <span class="nx">n</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
                    <span class="p">}</span>
                <span class="p">}</span>
            <span class="p">}</span>

            <span class="c1">//var self = this;</span>
            <span class="c1">//debugger;</span>
        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">isCollapsed</span> <span class="o">=</span> <span class="nx">sel</span><span class="p">.</span><span class="nx">isCollapsed</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">anchorNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">resolve</span><span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">anchorNode</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">focusNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">resolve</span><span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">focusNode</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">anchorOffset</span> <span class="o">=</span> <span class="nx">sel</span><span class="p">.</span><span class="nx">anchorOffset</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">focusOffset</span> <span class="o">=</span> <span class="nx">sel</span><span class="p">.</span><span class="nx">focusOffset</span><span class="p">;</span>
            
            <span class="k">this</span><span class="p">.</span><span class="nx">anchorTextNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">anchorNode</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">focusTextNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">focusNode</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">text</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">text</span> <span class="o">=</span> <span class="nx">sel</span><span class="p">.</span><span class="nx">text</span><span class="p">;</span>
        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">sel</span><span class="p">.</span><span class="nx">toString</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">text</span> <span class="o">=</span> <span class="nx">sel</span><span class="p">.</span><span class="nx">toString</span><span class="p">();</span>
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">text</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">}</span>
    <span class="p">};</span>
    
    <span class="cm">/**</span>
<span class="cm">    * Performs a prefilter on all nodes in the editor. Looks for nodes with a style: fontFamily or font face</span>
<span class="cm">    * It then creates a dynamic class assigns it and removed the property. This is so that we don&#39;t lose</span>
<span class="cm">    * the fontFamily when selecting nodes.</span>
<span class="cm">    * @static</span>
<span class="cm">    * @method filter</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">filter</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">blocks</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">startTime</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nb">Date</span><span class="p">()).</span><span class="nx">getTime</span><span class="p">();</span>
        <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Filtering nodes&#39;</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>

        <span class="kd">var</span> <span class="nx">nodes</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">ALL</span><span class="p">),</span>
            <span class="nx">baseNodes</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;strong,em&#39;</span><span class="p">),</span>
            <span class="nx">doc</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">,</span>
            <span class="nx">hrs</span> <span class="o">=</span> <span class="nx">doc</span><span class="p">.</span><span class="nx">getElementsByTagName</span><span class="p">(</span><span class="s1">&#39;hr&#39;</span><span class="p">),</span>
            <span class="nx">classNames</span> <span class="o">=</span> <span class="p">{},</span> <span class="nx">cssString</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">,</span>
            <span class="nx">ls</span><span class="p">;</span>

        <span class="kd">var</span> <span class="nx">startTime1</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nb">Date</span><span class="p">()).</span><span class="nx">getTime</span><span class="p">();</span>
        <span class="nx">nodes</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">raw</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">getDOMNode</span><span class="p">(</span><span class="nx">n</span><span class="p">);</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">raw</span><span class="p">.</span><span class="nx">style</span><span class="p">[</span><span class="nx">FONT_FAMILY</span><span class="p">])</span> <span class="p">{</span>
                <span class="nx">classNames</span><span class="p">[</span><span class="s1">&#39;.&#39;</span> <span class="o">+</span> <span class="nx">n</span><span class="p">.</span><span class="nx">_yuid</span><span class="p">]</span> <span class="o">=</span> <span class="nx">raw</span><span class="p">.</span><span class="nx">style</span><span class="p">[</span><span class="nx">FONT_FAMILY</span><span class="p">];</span>
                <span class="nx">n</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">n</span><span class="p">.</span><span class="nx">_yuid</span><span class="p">);</span>
                <span class="nx">raw</span><span class="p">.</span><span class="nx">style</span><span class="p">[</span><span class="nx">FONT_FAMILY</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;inherit&#39;</span><span class="p">;</span>

                <span class="nx">raw</span><span class="p">.</span><span class="nx">removeAttribute</span><span class="p">(</span><span class="s1">&#39;face&#39;</span><span class="p">);</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">raw</span><span class="p">.</span><span class="nx">getAttribute</span><span class="p">(</span><span class="s1">&#39;style&#39;</span><span class="p">)</span> <span class="o">===</span> <span class="s1">&#39;&#39;</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">raw</span><span class="p">.</span><span class="nx">removeAttribute</span><span class="p">(</span><span class="s1">&#39;style&#39;</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="c1">//This is for IE</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">raw</span><span class="p">.</span><span class="nx">getAttribute</span><span class="p">(</span><span class="s1">&#39;style&#39;</span><span class="p">))</span> <span class="p">{</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">raw</span><span class="p">.</span><span class="nx">getAttribute</span><span class="p">(</span><span class="s1">&#39;style&#39;</span><span class="p">).</span><span class="nx">toLowerCase</span><span class="p">()</span> <span class="o">===</span> <span class="s1">&#39;font-family: &#39;</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">raw</span><span class="p">.</span><span class="nx">removeAttribute</span><span class="p">(</span><span class="s1">&#39;style&#39;</span><span class="p">);</span>
                    <span class="p">}</span>
                <span class="p">}</span>
            <span class="p">}</span>
            <span class="cm">/*</span>
<span class="cm">            if (n.getStyle(FONT_FAMILY)) {</span>
<span class="cm">                classNames[&#39;.&#39; + n._yuid] = n.getStyle(FONT_FAMILY);</span>
<span class="cm">                n.addClass(n._yuid);</span>
<span class="cm">                n.removeAttribute(&#39;face&#39;);</span>
<span class="cm">                n.setStyle(FONT_FAMILY, &#39;&#39;);</span>
<span class="cm">                if (n.getAttribute(&#39;style&#39;) === &#39;&#39;) {</span>
<span class="cm">                    n.removeAttribute(&#39;style&#39;);</span>
<span class="cm">                }</span>
<span class="cm">                //This is for IE</span>
<span class="cm">                if (n.getAttribute(&#39;style&#39;).toLowerCase() === &#39;font-family: &#39;) {</span>
<span class="cm">                    n.removeAttribute(&#39;style&#39;);</span>
<span class="cm">                }</span>
<span class="cm">            }</span>
<span class="cm">            */</span>
        <span class="p">});</span>
        <span class="kd">var</span> <span class="nx">endTime1</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nb">Date</span><span class="p">()).</span><span class="nx">getTime</span><span class="p">();</span>
        <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Node Filter Timer: &#39;</span> <span class="o">+</span> <span class="p">(</span><span class="nx">endTime1</span> <span class="o">-</span> <span class="nx">startTime1</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;ms&#39;</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>

        <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;.hr&#39;</span><span class="p">).</span><span class="nx">addClass</span><span class="p">(</span><span class="s1">&#39;yui-skip&#39;</span><span class="p">).</span><span class="nx">addClass</span><span class="p">(</span><span class="s1">&#39;yui-non&#39;</span><span class="p">);</span>

        <span class="nx">Y</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">hrs</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">hr</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="nx">doc</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s1">&#39;div&#39;</span><span class="p">);</span>
                <span class="nx">el</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s1">&#39;hr yui-non yui-skip&#39;</span><span class="p">;</span>
                
                <span class="nx">el</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="s1">&#39;readonly&#39;</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
                <span class="nx">el</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="s1">&#39;contenteditable&#39;</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span> <span class="c1">//Keep it from being Edited</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">hr</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">hr</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">.</span><span class="nx">replaceChild</span><span class="p">(</span><span class="nx">el</span><span class="p">,</span> <span class="nx">hr</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="c1">//Had to move to inline style. writes for ie&#39;s &lt; 8. They don&#39;t render el.setAttribute(&#39;style&#39;);</span>
                <span class="kd">var</span> <span class="nx">s</span> <span class="o">=</span> <span class="nx">el</span><span class="p">.</span><span class="nx">style</span><span class="p">;</span>
                <span class="nx">s</span><span class="p">.</span><span class="nx">border</span> <span class="o">=</span> <span class="s1">&#39;1px solid #ccc&#39;</span><span class="p">;</span>
                <span class="nx">s</span><span class="p">.</span><span class="nx">lineHeight</span> <span class="o">=</span> <span class="s1">&#39;0&#39;</span><span class="p">;</span>
                <span class="nx">s</span><span class="p">.</span><span class="nx">fontSize</span> <span class="o">=</span> <span class="s1">&#39;0&#39;</span><span class="p">;</span>
                <span class="nx">s</span><span class="p">.</span><span class="nx">marginTop</span> <span class="o">=</span> <span class="s1">&#39;5px&#39;</span><span class="p">;</span>
                <span class="nx">s</span><span class="p">.</span><span class="nx">marginBottom</span> <span class="o">=</span> <span class="s1">&#39;5px&#39;</span><span class="p">;</span>
                <span class="nx">s</span><span class="p">.</span><span class="nx">marginLeft</span> <span class="o">=</span> <span class="s1">&#39;0px&#39;</span><span class="p">;</span>
                <span class="nx">s</span><span class="p">.</span><span class="nx">marginRight</span> <span class="o">=</span> <span class="s1">&#39;0px&#39;</span><span class="p">;</span>
                <span class="nx">s</span><span class="p">.</span><span class="nx">padding</span> <span class="o">=</span> <span class="s1">&#39;0&#39;</span><span class="p">;</span>
        <span class="p">});</span>
        

        <span class="nx">Y</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">classNames</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span> <span class="nx">k</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">cssString</span> <span class="o">+=</span> <span class="nx">k</span> <span class="o">+</span> <span class="s1">&#39; { font-family: &#39;</span> <span class="o">+</span> <span class="nx">v</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/&quot;/gi</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;; }&#39;</span><span class="p">;</span>
        <span class="p">});</span>
        <span class="nx">Y</span><span class="p">.</span><span class="nx">StyleSheet</span><span class="p">(</span><span class="nx">cssString</span><span class="p">,</span> <span class="s1">&#39;editor&#39;</span><span class="p">);</span>

        
        <span class="c1">//Not sure about this one?</span>
        <span class="nx">baseNodes</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">,</span> <span class="nx">k</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">t</span> <span class="o">=</span> <span class="nx">n</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;tagName&#39;</span><span class="p">).</span><span class="nx">toLowerCase</span><span class="p">(),</span>
                <span class="nx">newTag</span> <span class="o">=</span> <span class="s1">&#39;i&#39;</span><span class="p">;</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">t</span> <span class="o">===</span> <span class="s1">&#39;strong&#39;</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">newTag</span> <span class="o">=</span> <span class="s1">&#39;b&#39;</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_swap</span><span class="p">(</span><span class="nx">baseNodes</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="nx">k</span><span class="p">),</span> <span class="nx">newTag</span><span class="p">);</span>
        <span class="p">});</span>

        <span class="c1">//Filter out all the empty UL/OL&#39;s</span>
        <span class="nx">ls</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;ol,ul&#39;</span><span class="p">);</span>
        <span class="nx">ls</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">v</span><span class="p">,</span> <span class="nx">k</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">lis</span> <span class="o">=</span> <span class="nx">v</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;li&#39;</span><span class="p">);</span>
            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">lis</span><span class="p">.</span><span class="nx">size</span><span class="p">())</span> <span class="p">{</span>
                <span class="nx">v</span><span class="p">.</span><span class="nx">remove</span><span class="p">();</span>
            <span class="p">}</span>
        <span class="p">});</span>
        
        <span class="k">if</span> <span class="p">(</span><span class="nx">blocks</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">filterBlocks</span><span class="p">();</span>
        <span class="p">}</span>
        <span class="kd">var</span> <span class="nx">endTime</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nb">Date</span><span class="p">()).</span><span class="nx">getTime</span><span class="p">();</span>
        <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Filter Timer: &#39;</span> <span class="o">+</span> <span class="p">(</span><span class="nx">endTime</span> <span class="o">-</span> <span class="nx">startTime</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;ms&#39;</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
    <span class="p">};</span>

    <span class="cm">/**</span>
<span class="cm">    * Method attempts to replace all &quot;orphined&quot; text nodes in the main body by wrapping them with a &lt;p&gt;. Called from filter.</span>
<span class="cm">    * @static</span>
<span class="cm">    * @method filterBlocks</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">filterBlocks</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">startTime</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nb">Date</span><span class="p">()).</span><span class="nx">getTime</span><span class="p">();</span>
        <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;RAW filter blocks&#39;</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
        <span class="kd">var</span> <span class="nx">childs</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">,</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">node</span><span class="p">,</span> <span class="nx">wrapped</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nx">doit</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
            <span class="nx">sel</span><span class="p">,</span> <span class="nx">single</span><span class="p">,</span> <span class="nx">br</span><span class="p">,</span> <span class="nx">divs</span><span class="p">,</span> <span class="nx">spans</span><span class="p">,</span> <span class="nx">c</span><span class="p">,</span> <span class="nx">s</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">childs</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">childs</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">node</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">childs</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">node</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">BLOCKS</span><span class="p">))</span> <span class="p">{</span>
                    <span class="nx">doit</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">childs</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">nodeType</span> <span class="o">==</span> <span class="mi">3</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">c</span> <span class="o">=</span> <span class="nx">childs</span><span class="p">[</span><span class="nx">i</span><span class="p">][</span><span class="nx">textContent</span><span class="p">].</span><span class="nx">match</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">REG_CHAR</span><span class="p">);</span>
                        <span class="nx">s</span> <span class="o">=</span> <span class="nx">childs</span><span class="p">[</span><span class="nx">i</span><span class="p">][</span><span class="nx">textContent</span><span class="p">].</span><span class="nx">match</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">REG_NON</span><span class="p">);</span>
                        <span class="k">if</span> <span class="p">(</span><span class="nx">c</span> <span class="o">===</span> <span class="kc">null</span> <span class="o">&amp;&amp;</span> <span class="nx">s</span><span class="p">)</span> <span class="p">{</span>
                            <span class="nx">doit</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
                            
                        <span class="p">}</span>
                    <span class="p">}</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">doit</span><span class="p">)</span> <span class="p">{</span>
                        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">wrapped</span><span class="p">)</span> <span class="p">{</span>
                            <span class="nx">wrapped</span> <span class="o">=</span> <span class="p">[];</span>
                        <span class="p">}</span>
                        <span class="nx">wrapped</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">childs</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
                    <span class="p">}</span>
                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">wrapped</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">_wrapBlock</span><span class="p">(</span><span class="nx">wrapped</span><span class="p">);</span>
                <span class="p">}</span>
            <span class="p">}</span>
            <span class="nx">wrapped</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">_wrapBlock</span><span class="p">(</span><span class="nx">wrapped</span><span class="p">);</span>
        <span class="p">}</span>

        <span class="nx">single</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">DEFAULT_BLOCK_TAG</span><span class="p">);</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">single</span><span class="p">.</span><span class="nx">size</span><span class="p">()</span> <span class="o">===</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Only One default block tag (&#39;</span> <span class="o">+</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">DEFAULT_BLOCK_TAG</span> <span class="o">+</span> <span class="s1">&#39;), focus it..&#39;</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
            <span class="nx">br</span> <span class="o">=</span> <span class="nx">single</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="mi">0</span><span class="p">).</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;br&#39;</span><span class="p">);</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">br</span><span class="p">.</span><span class="nx">size</span><span class="p">()</span> <span class="o">===</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">br</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="mi">0</span><span class="p">).</span><span class="nx">test</span><span class="p">(</span><span class="s1">&#39;.yui-cursor&#39;</span><span class="p">))</span> <span class="p">{</span>
                    <span class="nx">br</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="mi">0</span><span class="p">).</span><span class="nx">remove</span><span class="p">();</span>
                <span class="p">}</span>
                <span class="kd">var</span> <span class="nx">html</span> <span class="o">=</span> <span class="nx">single</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="mi">0</span><span class="p">).</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">);</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">html</span> <span class="o">===</span> <span class="s1">&#39;&#39;</span> <span class="o">||</span> <span class="nx">html</span> <span class="o">===</span> <span class="s1">&#39; &#39;</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Paragraph empty, focusing cursor&#39;</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
                    <span class="nx">single</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">,</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">CURSOR</span><span class="p">);</span>
                    <span class="nx">sel</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">();</span>
                    <span class="nx">sel</span><span class="p">.</span><span class="nx">focusCursor</span><span class="p">(</span><span class="kc">true</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
                <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
            <span class="nx">single</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">p</span><span class="p">)</span> <span class="p">{</span>
                <span class="kd">var</span> <span class="nx">html</span> <span class="o">=</span> <span class="nx">p</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">);</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">html</span> <span class="o">===</span> <span class="s1">&#39;&#39;</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Empty Paragraph Tag Found, Removing It&#39;</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
                    <span class="nx">p</span><span class="p">.</span><span class="nx">remove</span><span class="p">();</span>
                <span class="p">}</span>
            <span class="p">});</span>
        <span class="p">}</span>
        
        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">Y</span><span class="p">.</span><span class="nx">UA</span><span class="p">.</span><span class="nx">ie</span><span class="p">)</span> <span class="p">{</span>
            <span class="cm">/*</span>
<span class="cm">            divs = Y.all(&#39;div, p&#39;);</span>
<span class="cm">            divs.each(function(d) {</span>
<span class="cm">                if (d.hasClass(&#39;yui-non&#39;)) {</span>
<span class="cm">                    return;</span>
<span class="cm">                }</span>
<span class="cm">                var html = d.get(&#39;innerHTML&#39;);</span>
<span class="cm">                if (html === &#39;&#39;) {</span>
<span class="cm">                    Y.log(&#39;Empty DIV/P Tag Found, Removing It&#39;, &#39;info&#39;, &#39;selection&#39;);</span>
<span class="cm">                    d.remove();</span>
<span class="cm">                } else {</span>
<span class="cm">                    Y.log(&#39;DIVS/PS Count: &#39; + d.get(&#39;childNodes&#39;).size(), &#39;info&#39;, &#39;selection&#39;);</span>
<span class="cm">                    if (d.get(&#39;childNodes&#39;).size() == 1) {</span>
<span class="cm">                        Y.log(&#39;This Div/P only has one Child Node&#39;, &#39;info&#39;, &#39;selection&#39;);</span>
<span class="cm">                        if (d.ancestor(&#39;p&#39;)) {</span>
<span class="cm">                            Y.log(&#39;This Div/P is a child of a paragraph, remove it..&#39;, &#39;info&#39;, &#39;selection&#39;);</span>
<span class="cm">                            d.replace(d.get(&#39;firstChild&#39;));</span>
<span class="cm">                        }</span>
<span class="cm">                    }</span>
<span class="cm">                }</span>
<span class="cm">            });*/</span>

            <span class="cm">/** Removed this, as it was causing Pasting to be funky in Safari</span>
<span class="cm">            spans = Y.all(&#39;.Apple-style-span, .apple-style-span&#39;);</span>
<span class="cm">            Y.log(&#39;Apple Spans found: &#39; + spans.size(), &#39;info&#39;, &#39;selection&#39;);</span>
<span class="cm">            spans.each(function(s) {</span>
<span class="cm">                s.setAttribute(&#39;style&#39;, &#39;&#39;);</span>
<span class="cm">            });</span>
<span class="cm">            */</span>
        <span class="p">}</span>


        <span class="kd">var</span> <span class="nx">endTime</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nb">Date</span><span class="p">()).</span><span class="nx">getTime</span><span class="p">();</span>
        <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;FilterBlocks Timer: &#39;</span> <span class="o">+</span> <span class="p">(</span><span class="nx">endTime</span> <span class="o">-</span> <span class="nx">startTime</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;ms&#39;</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
    <span class="p">};</span>

    <span class="cm">/**</span>
<span class="cm">    * Regular Expression to determine if a string has a character in it</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property REG_CHAR</span>
<span class="cm">    */</span>   
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">REG_CHAR</span> <span class="o">=</span> <span class="sr">/[a-zA-Z-0-9_]/gi</span><span class="p">;</span>

    <span class="cm">/**</span>
<span class="cm">    * Regular Expression to determine if a string has a non-character in it</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property REG_NON</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">REG_NON</span> <span class="o">=</span> <span class="sr">/[\s\S|\n|\t]/gi</span><span class="p">;</span>

    <span class="cm">/**</span>
<span class="cm">    * Regular Expression to remove all HTML from a string</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property REG_NOHTML</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">REG_NOHTML</span> <span class="o">=</span> <span class="sr">/&lt;\S[^&gt;&lt;]*&gt;/g</span><span class="p">;</span>


    <span class="cm">/**</span>
<span class="cm">    * Wraps an array of elements in a Block level tag</span>
<span class="cm">    * @static</span>
<span class="cm">    * @private</span>
<span class="cm">    * @method _wrapBlock</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">_wrapBlock</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">wrapped</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">wrapped</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">newChild</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">&#39;&lt;&#39;</span> <span class="o">+</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">DEFAULT_BLOCK_TAG</span> <span class="o">+</span> <span class="s1">&#39;&gt;&lt;/&#39;</span> <span class="o">+</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">DEFAULT_BLOCK_TAG</span> <span class="o">+</span> <span class="s1">&#39;&gt;&#39;</span><span class="p">),</span>
                <span class="nx">firstChild</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">wrapped</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="nx">i</span><span class="p">;</span>

            <span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">wrapped</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">newChild</span><span class="p">.</span><span class="nx">append</span><span class="p">(</span><span class="nx">wrapped</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
            <span class="p">}</span>
            <span class="nx">firstChild</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="nx">newChild</span><span class="p">);</span>
            <span class="nx">newChild</span><span class="p">.</span><span class="nx">prepend</span><span class="p">(</span><span class="nx">firstChild</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">return</span> <span class="kc">false</span><span class="p">;</span>
    <span class="p">};</span>

    <span class="cm">/**</span>
<span class="cm">    * Undoes what filter does enough to return the HTML from the Editor, then re-applies the filter.</span>
<span class="cm">    * @static</span>
<span class="cm">    * @method unfilter</span>
<span class="cm">    * @return {String} The filtered HTML</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">unfilter</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">nodes</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;body [class]&#39;</span><span class="p">),</span>
            <span class="nx">html</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="nx">nons</span><span class="p">,</span> <span class="nx">ids</span><span class="p">,</span>
            <span class="nx">body</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="s1">&#39;body&#39;</span><span class="p">);</span>
        
        <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;UnFiltering nodes&#39;</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
        
        <span class="nx">nodes</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">n</span><span class="p">.</span><span class="nx">hasClass</span><span class="p">(</span><span class="nx">n</span><span class="p">.</span><span class="nx">_yuid</span><span class="p">))</span> <span class="p">{</span>
                <span class="c1">//One of ours</span>
                <span class="nx">n</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="nx">FONT_FAMILY</span><span class="p">,</span> <span class="nx">n</span><span class="p">.</span><span class="nx">getStyle</span><span class="p">(</span><span class="nx">FONT_FAMILY</span><span class="p">));</span>
                <span class="nx">n</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="nx">n</span><span class="p">.</span><span class="nx">_yuid</span><span class="p">);</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">n</span><span class="p">.</span><span class="nx">getAttribute</span><span class="p">(</span><span class="s1">&#39;class&#39;</span><span class="p">)</span> <span class="o">===</span> <span class="s1">&#39;&#39;</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">n</span><span class="p">.</span><span class="nx">removeAttribute</span><span class="p">(</span><span class="s1">&#39;class&#39;</span><span class="p">);</span>
                <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">});</span>

        <span class="nx">nons</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;.yui-non&#39;</span><span class="p">);</span>
        <span class="nx">nons</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">n</span><span class="p">.</span><span class="nx">hasClass</span><span class="p">(</span><span class="s1">&#39;yui-skip&#39;</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">n</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">)</span> <span class="o">===</span> <span class="s1">&#39;&#39;</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">n</span><span class="p">.</span><span class="nx">remove</span><span class="p">();</span>
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="nx">n</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="s1">&#39;yui-non&#39;</span><span class="p">).</span><span class="nx">removeClass</span><span class="p">(</span><span class="s1">&#39;yui-skip&#39;</span><span class="p">);</span>
            <span class="p">}</span>
        <span class="p">});</span>

        <span class="nx">ids</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;body [id]&#39;</span><span class="p">);</span>
        <span class="nx">ids</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">n</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;id&#39;</span><span class="p">).</span><span class="nx">indexOf</span><span class="p">(</span><span class="s1">&#39;yui_3_&#39;</span><span class="p">)</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">n</span><span class="p">.</span><span class="nx">removeAttribute</span><span class="p">(</span><span class="s1">&#39;id&#39;</span><span class="p">);</span>
                <span class="nx">n</span><span class="p">.</span><span class="nx">removeAttribute</span><span class="p">(</span><span class="s1">&#39;_yuid&#39;</span><span class="p">);</span>
            <span class="p">}</span>
        <span class="p">});</span>
        
        <span class="k">if</span> <span class="p">(</span><span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">html</span> <span class="o">=</span> <span class="nx">body</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">);</span>
        <span class="p">}</span>
        
        <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;.hr&#39;</span><span class="p">).</span><span class="nx">addClass</span><span class="p">(</span><span class="s1">&#39;yui-skip&#39;</span><span class="p">).</span><span class="nx">addClass</span><span class="p">(</span><span class="s1">&#39;yui-non&#39;</span><span class="p">);</span>
        
        <span class="cm">/*</span>
<span class="cm">        nodes.each(function(n) {</span>
<span class="cm">            n.addClass(n._yuid);</span>
<span class="cm">            n.setStyle(FONT_FAMILY, &#39;&#39;);</span>
<span class="cm">            if (n.getAttribute(&#39;style&#39;) === &#39;&#39;) {</span>
<span class="cm">                n.removeAttribute(&#39;style&#39;);</span>
<span class="cm">            }</span>
<span class="cm">        });</span>
<span class="cm">        */</span>
        
        <span class="k">return</span> <span class="nx">html</span><span class="p">;</span>
    <span class="p">};</span>
    <span class="cm">/**</span>
<span class="cm">    * Resolve a node from the selection object and return a Node instance</span>
<span class="cm">    * @static</span>
<span class="cm">    * @method resolve</span>
<span class="cm">    * @param {HTMLElement} n The HTMLElement to resolve. Might be a TextNode, gives parentNode.</span>
<span class="cm">    * @return {Node} The Resolved node</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">resolve</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">n</span> <span class="o">&amp;&amp;</span> <span class="nx">n</span><span class="p">.</span><span class="nx">nodeType</span> <span class="o">===</span> <span class="mi">3</span><span class="p">)</span> <span class="p">{</span>
            <span class="c1">//Adding a try/catch here because in rare occasions IE will</span>
            <span class="c1">//Throw a error accessing the parentNode of a stranded text node.</span>
            <span class="c1">//In the case of Ctrl+Z (Undo)</span>
            <span class="k">try</span> <span class="p">{</span>
                <span class="nx">n</span> <span class="o">=</span> <span class="nx">n</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">;</span>
            <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">re</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">n</span> <span class="o">=</span> <span class="s1">&#39;body&#39;</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">}</span>
        <span class="k">return</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">n</span><span class="p">);</span>
    <span class="p">};</span>

    <span class="cm">/**</span>
<span class="cm">    * Returns the innerHTML of a node with all HTML tags removed.</span>
<span class="cm">    * @static</span>
<span class="cm">    * @method getText</span>
<span class="cm">    * @param {Node} node The Node instance to remove the HTML from</span>
<span class="cm">    * @return {String} The string of text</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">getText</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">txt</span> <span class="o">=</span> <span class="nx">node</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">).</span><span class="nx">replace</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">REG_NOHTML</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">);</span>
        <span class="c1">//Clean out the cursor subs to see if the Node is empty</span>
        <span class="nx">txt</span> <span class="o">=</span> <span class="nx">txt</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="s1">&#39;&lt;span&gt;&lt;br&gt;&lt;/span&gt;&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">).</span><span class="nx">replace</span><span class="p">(</span><span class="s1">&#39;&lt;br&gt;&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">);</span>
        <span class="k">return</span> <span class="nx">txt</span><span class="p">;</span>
    <span class="p">};</span>

    <span class="c1">//Y.Selection.DEFAULT_BLOCK_TAG = &#39;div&#39;;</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">DEFAULT_BLOCK_TAG</span> <span class="o">=</span> <span class="s1">&#39;p&#39;</span><span class="p">;</span>

    <span class="cm">/**</span>
<span class="cm">    * The selector to use when looking for Nodes to cache the value of: [style],font[face]</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property ALL</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">ALL</span> <span class="o">=</span> <span class="s1">&#39;[style],font[face]&#39;</span><span class="p">;</span>

    <span class="cm">/**</span>
<span class="cm">    * The selector to use when looking for block level items.</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property BLOCKS</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">BLOCKS</span> <span class="o">=</span> <span class="s1">&#39;p,div,ul,ol,table,style&#39;</span><span class="p">;</span>
    <span class="cm">/**</span>
<span class="cm">    * The temporary fontname applied to a selection to retrieve their values: yui-tmp</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property TMP</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">TMP</span> <span class="o">=</span> <span class="s1">&#39;yui-tmp&#39;</span><span class="p">;</span>
    <span class="cm">/**</span>
<span class="cm">    * The default tag to use when creating elements: span</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property DEFAULT_TAG</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">DEFAULT_TAG</span> <span class="o">=</span> <span class="s1">&#39;span&#39;</span><span class="p">;</span>

    <span class="cm">/**</span>
<span class="cm">    * The id of the outer cursor wrapper</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property DEFAULT_TAG</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">CURID</span> <span class="o">=</span> <span class="s1">&#39;yui-cursor&#39;</span><span class="p">;</span>

    <span class="cm">/**</span>
<span class="cm">    * The id used to wrap the inner space of the cursor position</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property CUR_WRAPID</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">CUR_WRAPID</span> <span class="o">=</span> <span class="s1">&#39;yui-cursor-wrapper&#39;</span><span class="p">;</span>

    <span class="cm">/**</span>
<span class="cm">    * The default HTML used to focus the cursor..</span>
<span class="cm">    * @static</span>
<span class="cm">    * @property CURSOR</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">CURSOR</span> <span class="o">=</span> <span class="s1">&#39;&lt;span&gt;&lt;br class=&quot;yui-cursor&quot;&gt;&lt;/span&gt;&#39;</span><span class="p">;</span>

    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">hasCursor</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">cur</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;#&#39;</span> <span class="o">+</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">CUR_WRAPID</span><span class="p">);</span>
        <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Has Cursor: &#39;</span> <span class="o">+</span> <span class="nx">cur</span><span class="p">.</span><span class="nx">size</span><span class="p">(),</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
        <span class="k">return</span> <span class="nx">cur</span><span class="p">.</span><span class="nx">size</span><span class="p">();</span>
    <span class="p">};</span>

    <span class="cm">/**</span>
<span class="cm">    * Called from Editor keydown to remove the &quot;extra&quot; space before the cursor.</span>
<span class="cm">    * @static</span>
<span class="cm">    * @method cleanCursor</span>
<span class="cm">    */</span>
    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">cleanCursor</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
        <span class="c1">//Y.log(&#39;Cleaning Cursor&#39;, &#39;info&#39;, &#39;Selection&#39;);</span>
        <span class="kd">var</span> <span class="nx">cur</span><span class="p">,</span> <span class="nx">sel</span> <span class="o">=</span> <span class="s1">&#39;br.yui-cursor&#39;</span><span class="p">;</span>
        <span class="nx">cur</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="nx">sel</span><span class="p">);</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">cur</span><span class="p">.</span><span class="nx">size</span><span class="p">())</span> <span class="p">{</span>
            <span class="nx">cur</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">b</span><span class="p">)</span> <span class="p">{</span>
                <span class="kd">var</span> <span class="nx">c</span> <span class="o">=</span> <span class="nx">b</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;parentNode.parentNode.childNodes&#39;</span><span class="p">),</span> <span class="nx">html</span><span class="p">;</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">c</span><span class="p">.</span><span class="nx">size</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">b</span><span class="p">.</span><span class="nx">remove</span><span class="p">();</span>
                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">html</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">getText</span><span class="p">(</span><span class="nx">c</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="mi">0</span><span class="p">));</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">html</span> <span class="o">!==</span> <span class="s1">&#39;&#39;</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">b</span><span class="p">.</span><span class="nx">remove</span><span class="p">();</span>
                    <span class="p">}</span>
                <span class="p">}</span>
            <span class="p">});</span>
        <span class="p">}</span>
        <span class="cm">/*</span>
<span class="cm">        var cur = Y.all(&#39;#&#39; + Y.Selection.CUR_WRAPID);</span>
<span class="cm">        if (cur.size()) {</span>
<span class="cm">            cur.each(function(c) {</span>
<span class="cm">                var html = c.get(&#39;innerHTML&#39;);</span>
<span class="cm">                if (html == &#39;&amp;nbsp;&#39; || html == &#39;&lt;br&gt;&#39;) {</span>
<span class="cm">                    if (c.previous() || c.next()) {</span>
<span class="cm">                        c.remove();</span>
<span class="cm">                    }</span>
<span class="cm">                }</span>
<span class="cm">            });</span>
<span class="cm">        }</span>
<span class="cm">        */</span>
    <span class="p">};</span>

    <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="p">{</span>
        <span class="cm">/**</span>
<span class="cm">        * Range text value</span>
<span class="cm">        * @property text</span>
<span class="cm">        * @type String</span>
<span class="cm">        */</span>
        <span class="nx">text</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="cm">/**</span>
<span class="cm">        * Flag to show if the range is collapsed or not</span>
<span class="cm">        * @property isCollapsed</span>
<span class="cm">        * @type Boolean</span>
<span class="cm">        */</span>
        <span class="nx">isCollapsed</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="cm">/**</span>
<span class="cm">        * A Node instance of the parentNode of the anchorNode of the range</span>
<span class="cm">        * @property anchorNode</span>
<span class="cm">        * @type Node</span>
<span class="cm">        */</span>
        <span class="nx">anchorNode</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="cm">/**</span>
<span class="cm">        * The offset from the range object</span>
<span class="cm">        * @property anchorOffset</span>
<span class="cm">        * @type Number</span>
<span class="cm">        */</span>
        <span class="nx">anchorOffset</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="cm">/**</span>
<span class="cm">        * A Node instance of the actual textNode of the range.</span>
<span class="cm">        * @property anchorTextNode</span>
<span class="cm">        * @type Node</span>
<span class="cm">        */</span>
        <span class="nx">anchorTextNode</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="cm">/**</span>
<span class="cm">        * A Node instance of the parentNode of the focusNode of the range</span>
<span class="cm">        * @property focusNode</span>
<span class="cm">        * @type Node</span>
<span class="cm">        */</span>
        <span class="nx">focusNode</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="cm">/**</span>
<span class="cm">        * The offset from the range object</span>
<span class="cm">        * @property focusOffset</span>
<span class="cm">        * @type Number</span>
<span class="cm">        */</span>
        <span class="nx">focusOffset</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="cm">/**</span>
<span class="cm">        * A Node instance of the actual textNode of the range.</span>
<span class="cm">        * @property focusTextNode</span>
<span class="cm">        * @type Node</span>
<span class="cm">        */</span>
        <span class="nx">focusTextNode</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="cm">/**</span>
<span class="cm">        * The actual Selection/Range object</span>
<span class="cm">        * @property _selection</span>
<span class="cm">        * @private</span>
<span class="cm">        */</span>
        <span class="nx">_selection</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="cm">/**</span>
<span class="cm">        * Wrap an element, with another element </span>
<span class="cm">        * @private</span>
<span class="cm">        * @method _wrap</span>
<span class="cm">        * @param {HTMLElement} n The node to wrap </span>
<span class="cm">        * @param {String} tag The tag to use when creating the new element.</span>
<span class="cm">        * @return {HTMLElement} The wrapped node</span>
<span class="cm">        */</span>
        <span class="nx">_wrap</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">,</span> <span class="nx">tag</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">tmp</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">&#39;&lt;&#39;</span> <span class="o">+</span> <span class="nx">tag</span> <span class="o">+</span> <span class="s1">&#39;&gt;&lt;/&#39;</span> <span class="o">+</span> <span class="nx">tag</span> <span class="o">+</span> <span class="s1">&#39;&gt;&#39;</span><span class="p">);</span>
            <span class="nx">tmp</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="nx">INNER_HTML</span><span class="p">,</span> <span class="nx">n</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">INNER_HTML</span><span class="p">));</span>
            <span class="nx">n</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="nx">INNER_HTML</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">);</span>
            <span class="nx">n</span><span class="p">.</span><span class="nx">append</span><span class="p">(</span><span class="nx">tmp</span><span class="p">);</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">getDOMNode</span><span class="p">(</span><span class="nx">tmp</span><span class="p">);</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Swap an element, with another element </span>
<span class="cm">        * @private</span>
<span class="cm">        * @method _swap</span>
<span class="cm">        * @param {HTMLElement} n The node to swap </span>
<span class="cm">        * @param {String} tag The tag to use when creating the new element.</span>
<span class="cm">        * @return {HTMLElement} The new node</span>
<span class="cm">        */</span>
        <span class="nx">_swap</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">,</span> <span class="nx">tag</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">tmp</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">&#39;&lt;&#39;</span> <span class="o">+</span> <span class="nx">tag</span> <span class="o">+</span> <span class="s1">&#39;&gt;&lt;/&#39;</span> <span class="o">+</span> <span class="nx">tag</span> <span class="o">+</span> <span class="s1">&#39;&gt;&#39;</span><span class="p">);</span>
            <span class="nx">tmp</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="nx">INNER_HTML</span><span class="p">,</span> <span class="nx">n</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">INNER_HTML</span><span class="p">));</span>
            <span class="nx">n</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="nx">tmp</span><span class="p">,</span> <span class="nx">n</span><span class="p">);</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">getDOMNode</span><span class="p">(</span><span class="nx">tmp</span><span class="p">);</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Get all the nodes in the current selection. This method will actually perform a filter first.</span>
<span class="cm">        * Then it calls doc.execCommand(&#39;fontname&#39;, null, &#39;yui-tmp&#39;) to touch all nodes in the selection.</span>
<span class="cm">        * The it compiles a list of all nodes affected by the execCommand and builds a NodeList to return.</span>
<span class="cm">        * @method getSelected</span>
<span class="cm">        * @return {NodeList} A NodeList of all items in the selection.</span>
<span class="cm">        */</span>
        <span class="nx">getSelected</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">filter</span><span class="p">();</span>
            <span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">execCommand</span><span class="p">(</span><span class="s1">&#39;fontname&#39;</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">TMP</span><span class="p">);</span>
            <span class="kd">var</span> <span class="nx">nodes</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">ALL</span><span class="p">),</span>
                <span class="nx">items</span> <span class="o">=</span> <span class="p">[];</span>
            
            <span class="nx">nodes</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">,</span> <span class="nx">k</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">n</span><span class="p">.</span><span class="nx">getStyle</span><span class="p">(</span><span class="nx">FONT_FAMILY</span><span class="p">)</span> <span class="o">==</span>  <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">TMP</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">n</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="nx">FONT_FAMILY</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">);</span>
                    <span class="nx">n</span><span class="p">.</span><span class="nx">removeAttribute</span><span class="p">(</span><span class="s1">&#39;face&#39;</span><span class="p">);</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">n</span><span class="p">.</span><span class="nx">getAttribute</span><span class="p">(</span><span class="s1">&#39;style&#39;</span><span class="p">)</span> <span class="o">===</span> <span class="s1">&#39;&#39;</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">n</span><span class="p">.</span><span class="nx">removeAttribute</span><span class="p">(</span><span class="s1">&#39;style&#39;</span><span class="p">);</span>
                    <span class="p">}</span>
                    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">n</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="s1">&#39;body&#39;</span><span class="p">))</span> <span class="p">{</span>
                        <span class="nx">items</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">getDOMNode</span><span class="p">(</span><span class="nx">nodes</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="nx">k</span><span class="p">)));</span>
                    <span class="p">}</span>
                <span class="p">}</span>
            <span class="p">});</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="nx">items</span><span class="p">);</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Insert HTML at the current cursor position and return a Node instance of the newly inserted element.</span>
<span class="cm">        * @method insertContent</span>
<span class="cm">        * @param {String} html The HTML to insert.</span>
<span class="cm">        * @return {Node} The inserted Node.</span>
<span class="cm">        */</span>
        <span class="nx">insertContent</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">html</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">insertAtCursor</span><span class="p">(</span><span class="nx">html</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">anchorTextNode</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">anchorOffset</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Insert HTML at the current cursor position, this method gives you control over the text node to insert into and the offset where to put it.</span>
<span class="cm">        * @method insertAtCursor</span>
<span class="cm">        * @param {String} html The HTML to insert.</span>
<span class="cm">        * @param {Node} node The text node to break when inserting.</span>
<span class="cm">        * @param {Number} offset The left offset of the text node to break and insert the new content.</span>
<span class="cm">        * @param {Boolean} collapse Should the range be collapsed after insertion. default: false</span>
<span class="cm">        * @return {Node} The inserted Node.</span>
<span class="cm">        */</span>
        <span class="nx">insertAtCursor</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">html</span><span class="p">,</span> <span class="nx">node</span><span class="p">,</span> <span class="nx">offset</span><span class="p">,</span> <span class="nx">collapse</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">cur</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">&#39;&lt;&#39;</span> <span class="o">+</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">DEFAULT_TAG</span> <span class="o">+</span> <span class="s1">&#39; class=&quot;yui-non&quot;&gt;&lt;/&#39;</span> <span class="o">+</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">DEFAULT_TAG</span> <span class="o">+</span> <span class="s1">&#39;&gt;&#39;</span><span class="p">),</span>
                <span class="nx">inHTML</span><span class="p">,</span> <span class="nx">txt</span><span class="p">,</span> <span class="nx">txt2</span><span class="p">,</span> <span class="nx">newNode</span><span class="p">,</span> <span class="nx">range</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">createRange</span><span class="p">(),</span> <span class="nx">b</span><span class="p">;</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">node</span> <span class="o">&amp;&amp;</span> <span class="nx">node</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="s1">&#39;body&#39;</span><span class="p">))</span> <span class="p">{</span>
                <span class="nx">b</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">&#39;&lt;span&gt;&lt;/span&gt;&#39;</span><span class="p">);</span>
                <span class="nx">node</span><span class="p">.</span><span class="nx">append</span><span class="p">(</span><span class="nx">b</span><span class="p">);</span>
                <span class="nx">node</span> <span class="o">=</span> <span class="nx">b</span><span class="p">;</span>
            <span class="p">}</span>

            
            <span class="k">if</span> <span class="p">(</span><span class="nx">range</span><span class="p">.</span><span class="nx">pasteHTML</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">newNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="nx">html</span><span class="p">);</span>
                <span class="k">try</span> <span class="p">{</span>
                    <span class="nx">range</span><span class="p">.</span><span class="nx">pasteHTML</span><span class="p">(</span><span class="s1">&#39;&lt;span id=&quot;rte-insert&quot;&gt;&lt;/span&gt;&#39;</span><span class="p">);</span>
                <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{}</span>
                <span class="nx">inHTML</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="s1">&#39;#rte-insert&#39;</span><span class="p">);</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">inHTML</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">inHTML</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">&#39;id&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">);</span>
                    <span class="nx">inHTML</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="nx">newNode</span><span class="p">);</span>
                    <span class="k">return</span> <span class="nx">newNode</span><span class="p">;</span>
                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">Y</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">&#39;available&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
                        <span class="nx">inHTML</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">&#39;id&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">);</span>
                        <span class="nx">inHTML</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="nx">newNode</span><span class="p">);</span>
                    <span class="p">},</span> <span class="s1">&#39;#rte-insert&#39;</span><span class="p">);</span>
                <span class="p">}</span>
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="c1">//TODO using Y.Node.create here throws warnings &amp; strips first white space character</span>
                <span class="c1">//txt = Y.one(Y.Node.create(inHTML.substr(0, offset)));</span>
                <span class="c1">//txt2 = Y.one(Y.Node.create(inHTML.substr(offset)));</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">offset</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">inHTML</span> <span class="o">=</span> <span class="nx">node</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">textContent</span><span class="p">);</span>

                    <span class="nx">txt</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">createTextNode</span><span class="p">(</span><span class="nx">inHTML</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nx">offset</span><span class="p">)));</span>
                    <span class="nx">txt2</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">createTextNode</span><span class="p">(</span><span class="nx">inHTML</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="nx">offset</span><span class="p">)));</span>

                    <span class="nx">node</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="nx">txt</span><span class="p">,</span> <span class="nx">node</span><span class="p">);</span>
                    <span class="nx">newNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="nx">html</span><span class="p">);</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">newNode</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;nodeType&#39;</span><span class="p">)</span> <span class="o">===</span> <span class="mi">11</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">b</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">&#39;&lt;span&gt;&lt;/span&gt;&#39;</span><span class="p">);</span>
                        <span class="nx">b</span><span class="p">.</span><span class="nx">append</span><span class="p">(</span><span class="nx">newNode</span><span class="p">);</span>
                        <span class="nx">newNode</span> <span class="o">=</span> <span class="nx">b</span><span class="p">;</span>
                    <span class="p">}</span>
                    <span class="nx">txt</span><span class="p">.</span><span class="nx">insert</span><span class="p">(</span><span class="nx">newNode</span><span class="p">,</span> <span class="s1">&#39;after&#39;</span><span class="p">);</span>
                    <span class="c1">//if (txt2 &amp;&amp; txt2.get(&#39;length&#39;)) {</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">txt2</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">newNode</span><span class="p">.</span><span class="nx">insert</span><span class="p">(</span><span class="nx">cur</span><span class="p">,</span> <span class="s1">&#39;after&#39;</span><span class="p">);</span>
                        <span class="nx">cur</span><span class="p">.</span><span class="nx">insert</span><span class="p">(</span><span class="nx">txt2</span><span class="p">,</span> <span class="s1">&#39;after&#39;</span><span class="p">);</span>
                        <span class="k">this</span><span class="p">.</span><span class="nx">selectNode</span><span class="p">(</span><span class="nx">cur</span><span class="p">,</span> <span class="nx">collapse</span><span class="p">);</span>
                    <span class="p">}</span>
                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;nodeType&#39;</span><span class="p">)</span> <span class="o">===</span> <span class="mi">3</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">node</span> <span class="o">=</span> <span class="nx">node</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;parentNode&#39;</span><span class="p">);</span>
                    <span class="p">}</span>
                    <span class="nx">newNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="nx">html</span><span class="p">);</span>
                    <span class="nx">html</span> <span class="o">=</span> <span class="nx">node</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">).</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/\n/gi</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">);</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">html</span> <span class="o">===</span> <span class="s1">&#39;&#39;</span> <span class="o">||</span> <span class="nx">html</span> <span class="o">===</span> <span class="s1">&#39;&lt;br&gt;&#39;</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">node</span><span class="p">.</span><span class="nx">append</span><span class="p">(</span><span class="nx">newNode</span><span class="p">);</span>
                    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                        <span class="k">if</span> <span class="p">(</span><span class="nx">newNode</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;parentNode&#39;</span><span class="p">))</span> <span class="p">{</span>
                            <span class="nx">node</span><span class="p">.</span><span class="nx">insert</span><span class="p">(</span><span class="nx">newNode</span><span class="p">,</span> <span class="s1">&#39;before&#39;</span><span class="p">);</span>
                        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                            <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="s1">&#39;body&#39;</span><span class="p">).</span><span class="nx">prepend</span><span class="p">(</span><span class="nx">newNode</span><span class="p">);</span>
                        <span class="p">}</span>
                    <span class="p">}</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;firstChild&#39;</span><span class="p">).</span><span class="nx">test</span><span class="p">(</span><span class="s1">&#39;br&#39;</span><span class="p">))</span> <span class="p">{</span>
                        <span class="nx">node</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;firstChild&#39;</span><span class="p">).</span><span class="nx">remove</span><span class="p">();</span>
                    <span class="p">}</span>
                <span class="p">}</span>
            <span class="p">}</span>
            <span class="k">return</span> <span class="nx">newNode</span><span class="p">;</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Get all elements inside a selection and wrap them with a new element and return a NodeList of all elements touched.</span>
<span class="cm">        * @method wrapContent</span>
<span class="cm">        * @param {String} tag The tag to wrap all selected items with.</span>
<span class="cm">        * @return {NodeList} A NodeList of all items in the selection.</span>
<span class="cm">        */</span>
        <span class="nx">wrapContent</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">tag</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">tag</span> <span class="o">=</span> <span class="p">(</span><span class="nx">tag</span><span class="p">)</span> <span class="o">?</span> <span class="nx">tag</span> <span class="o">:</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">DEFAULT_TAG</span><span class="p">;</span>

            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">isCollapsed</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Wrapping selection with: &#39;</span> <span class="o">+</span> <span class="nx">tag</span><span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
                <span class="kd">var</span> <span class="nx">items</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getSelected</span><span class="p">(),</span>
                    <span class="nx">changed</span> <span class="o">=</span> <span class="p">[],</span> <span class="nx">range</span><span class="p">,</span> <span class="nx">last</span><span class="p">,</span> <span class="nx">first</span><span class="p">,</span> <span class="nx">range2</span><span class="p">;</span>

                <span class="nx">items</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">n</span><span class="p">,</span> <span class="nx">k</span><span class="p">)</span> <span class="p">{</span>
                    <span class="kd">var</span> <span class="nx">t</span> <span class="o">=</span> <span class="nx">n</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;tagName&#39;</span><span class="p">).</span><span class="nx">toLowerCase</span><span class="p">();</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">t</span> <span class="o">===</span> <span class="s1">&#39;font&#39;</span><span class="p">)</span> <span class="p">{</span>
                        <span class="nx">changed</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_swap</span><span class="p">(</span><span class="nx">items</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="nx">k</span><span class="p">),</span> <span class="nx">tag</span><span class="p">));</span>
                    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                        <span class="nx">changed</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_wrap</span><span class="p">(</span><span class="nx">items</span><span class="p">.</span><span class="nx">item</span><span class="p">(</span><span class="nx">k</span><span class="p">),</span> <span class="nx">tag</span><span class="p">));</span>
                    <span class="p">}</span>
                <span class="p">},</span> <span class="k">this</span><span class="p">);</span>
                
		        <span class="nx">range</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">createRange</span><span class="p">();</span>
                <span class="nx">first</span> <span class="o">=</span> <span class="nx">changed</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
                <span class="nx">last</span> <span class="o">=</span> <span class="nx">changed</span><span class="p">[</span><span class="nx">changed</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">];</span>
                <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_selection</span><span class="p">.</span><span class="nx">removeAllRanges</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">range</span><span class="p">.</span><span class="nx">setStart</span><span class="p">(</span><span class="nx">changed</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="mi">0</span><span class="p">);</span>
                    <span class="nx">range</span><span class="p">.</span><span class="nx">setEnd</span><span class="p">(</span><span class="nx">last</span><span class="p">,</span> <span class="nx">last</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">.</span><span class="nx">length</span><span class="p">);</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_selection</span><span class="p">.</span><span class="nx">removeAllRanges</span><span class="p">();</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_selection</span><span class="p">.</span><span class="nx">addRange</span><span class="p">(</span><span class="nx">range</span><span class="p">);</span>
                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">range</span><span class="p">.</span><span class="nx">moveToElementText</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">getDOMNode</span><span class="p">(</span><span class="nx">first</span><span class="p">));</span>
                    <span class="nx">range2</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">createRange</span><span class="p">();</span>
                    <span class="nx">range2</span><span class="p">.</span><span class="nx">moveToElementText</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">getDOMNode</span><span class="p">(</span><span class="nx">last</span><span class="p">));</span>
                    <span class="nx">range</span><span class="p">.</span><span class="nx">setEndPoint</span><span class="p">(</span><span class="s1">&#39;EndToEnd&#39;</span><span class="p">,</span> <span class="nx">range2</span><span class="p">);</span>
                    <span class="nx">range</span><span class="p">.</span><span class="nx">select</span><span class="p">();</span>
                <span class="p">}</span>

                <span class="nx">changed</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="nx">changed</span><span class="p">);</span>
                <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Returning NodeList with (&#39;</span> <span class="o">+</span> <span class="nx">changed</span><span class="p">.</span><span class="nx">size</span><span class="p">()</span> <span class="o">+</span> <span class="s1">&#39;) item(s)&#39;</span> <span class="p">,</span> <span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
                <span class="k">return</span> <span class="nx">changed</span><span class="p">;</span>


            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Can not wrap a collapsed selection, use insertContent&#39;</span><span class="p">,</span> <span class="s1">&#39;error&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
                <span class="k">return</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">([]);</span>
            <span class="p">}</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Find and replace a string inside a text node and replace it with HTML focusing the node after </span>
<span class="cm">        * to allow you to continue to type.</span>
<span class="cm">        * @method replace</span>
<span class="cm">        * @param {String} se The string to search for.</span>
<span class="cm">        * @param {String} re The string of HTML to replace it with.</span>
<span class="cm">        * @return {Node} The node inserted.</span>
<span class="cm">        */</span>
        <span class="nx">replace</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">se</span><span class="p">,</span><span class="nx">re</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;replacing (&#39;</span> <span class="o">+</span> <span class="nx">se</span> <span class="o">+</span> <span class="s1">&#39;) with (&#39;</span> <span class="o">+</span> <span class="nx">re</span> <span class="o">+</span> <span class="s1">&#39;)&#39;</span><span class="p">);</span>
            <span class="kd">var</span> <span class="nx">range</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">createRange</span><span class="p">(),</span> <span class="nx">node</span><span class="p">,</span> <span class="nx">txt</span><span class="p">,</span> <span class="nx">index</span><span class="p">,</span> <span class="nx">newNode</span><span class="p">;</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">range</span><span class="p">.</span><span class="nx">getBookmark</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">index</span> <span class="o">=</span> <span class="nx">range</span><span class="p">.</span><span class="nx">getBookmark</span><span class="p">();</span>
                <span class="nx">txt</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">anchorNode</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">).</span><span class="nx">replace</span><span class="p">(</span><span class="nx">se</span><span class="p">,</span> <span class="nx">re</span><span class="p">);</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">anchorNode</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">,</span> <span class="nx">txt</span><span class="p">);</span>
                <span class="nx">range</span><span class="p">.</span><span class="nx">moveToBookmark</span><span class="p">(</span><span class="nx">index</span><span class="p">);</span>
                <span class="nx">newNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="nx">range</span><span class="p">.</span><span class="nx">parentElement</span><span class="p">());</span>
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="nx">node</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">anchorTextNode</span><span class="p">;</span>
                <span class="nx">txt</span> <span class="o">=</span> <span class="nx">node</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">textContent</span><span class="p">);</span>
                <span class="nx">index</span> <span class="o">=</span> <span class="nx">txt</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">se</span><span class="p">);</span>

                <span class="nx">txt</span> <span class="o">=</span> <span class="nx">txt</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="nx">se</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">);</span>
                <span class="nx">node</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="nx">textContent</span><span class="p">,</span> <span class="nx">txt</span><span class="p">);</span>
                <span class="nx">newNode</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">insertAtCursor</span><span class="p">(</span><span class="nx">re</span><span class="p">,</span> <span class="nx">node</span><span class="p">,</span> <span class="nx">index</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
            <span class="p">}</span>
            <span class="k">return</span> <span class="nx">newNode</span><span class="p">;</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Destroy the range.</span>
<span class="cm">        * @method remove</span>
<span class="cm">        * @chainable</span>
<span class="cm">        * @return {Y.Selection}</span>
<span class="cm">        */</span>
        <span class="nx">remove</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_selection</span><span class="p">.</span><span class="nx">removeAllRanges</span><span class="p">();</span>
            <span class="k">return</span> <span class="k">this</span><span class="p">;</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Wrapper for the different range creation methods.</span>
<span class="cm">        * @method createRange</span>
<span class="cm">        * @return {RangeObject}</span>
<span class="cm">        */</span>
        <span class="nx">createRange</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">selection</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">return</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">selection</span><span class="p">.</span><span class="nx">createRange</span><span class="p">();</span>
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
		        <span class="k">return</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">doc</span><span class="p">.</span><span class="nx">createRange</span><span class="p">();</span>
            <span class="p">}</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Select a Node (hilighting it).</span>
<span class="cm">        * @method selectNode</span>
<span class="cm">        * @param {Node} node The node to select</span>
<span class="cm">        * @param {Boolean} collapse Should the range be collapsed after insertion. default: false</span>
<span class="cm">        * @chainable</span>
<span class="cm">        * @return {Y.Selection}</span>
<span class="cm">        */</span>
        <span class="nx">selectNode</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">collapse</span><span class="p">,</span> <span class="nx">end</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">Y</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;Node passed to selectNode is null&#39;</span><span class="p">,</span> <span class="s1">&#39;error&#39;</span><span class="p">,</span> <span class="s1">&#39;selection&#39;</span><span class="p">);</span>
                <span class="k">return</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="nx">end</span> <span class="o">=</span> <span class="nx">end</span> <span class="o">||</span> <span class="mi">0</span><span class="p">;</span>
            <span class="nx">node</span> <span class="o">=</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Node</span><span class="p">.</span><span class="nx">getDOMNode</span><span class="p">(</span><span class="nx">node</span><span class="p">);</span>
		    <span class="kd">var</span> <span class="nx">range</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">createRange</span><span class="p">();</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">range</span><span class="p">.</span><span class="nx">selectNode</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">range</span><span class="p">.</span><span class="nx">selectNode</span><span class="p">(</span><span class="nx">node</span><span class="p">);</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_selection</span><span class="p">.</span><span class="nx">removeAllRanges</span><span class="p">();</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_selection</span><span class="p">.</span><span class="nx">addRange</span><span class="p">(</span><span class="nx">range</span><span class="p">);</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">collapse</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">try</span> <span class="p">{</span>
                        <span class="k">this</span><span class="p">.</span><span class="nx">_selection</span><span class="p">.</span><span class="nx">collapse</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">end</span><span class="p">);</span>
                    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
                        <span class="k">this</span><span class="p">.</span><span class="nx">_selection</span><span class="p">.</span><span class="nx">collapse</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
                    <span class="p">}</span>
                <span class="p">}</span>
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">nodeType</span> <span class="o">===</span> <span class="mi">3</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">node</span> <span class="o">=</span> <span class="nx">node</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">;</span>
                <span class="p">}</span>
                <span class="k">try</span> <span class="p">{</span>
                    <span class="nx">range</span><span class="p">.</span><span class="nx">moveToElementText</span><span class="p">(</span><span class="nx">node</span><span class="p">);</span>
                <span class="p">}</span> <span class="k">catch</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{}</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">collapse</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">range</span><span class="p">.</span><span class="nx">collapse</span><span class="p">(((</span><span class="nx">end</span><span class="p">)</span> <span class="o">?</span> <span class="kc">false</span> <span class="o">:</span> <span class="kc">true</span><span class="p">));</span>
                <span class="p">}</span>
                <span class="nx">range</span><span class="p">.</span><span class="nx">select</span><span class="p">();</span>
            <span class="p">}</span>
            <span class="k">return</span> <span class="k">this</span><span class="p">;</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Put a placeholder in the DOM at the current cursor position.</span>
<span class="cm">        * @method setCursor</span>
<span class="cm">        * @return {Node}</span>
<span class="cm">        */</span>
        <span class="nx">setCursor</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">removeCursor</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
            <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">insertContent</span><span class="p">(</span><span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">CURSOR</span><span class="p">);</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Get the placeholder in the DOM at the current cursor position.</span>
<span class="cm">        * @method getCursor</span>
<span class="cm">        * @return {Node}</span>
<span class="cm">        */</span>
        <span class="nx">getCursor</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s1">&#39;#&#39;</span> <span class="o">+</span> <span class="nx">Y</span><span class="p">.</span><span class="nx">Selection</span><span class="p">.</span><span class="nx">CURID</span><span class="p">);</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Remove the cursor placeholder from the DOM.</span>
<span class="cm">        * @method removeCursor</span>
<span class="cm">        * @param {Boolean} keep Setting this to true will keep the node, but remove the unique parts that make it the cursor.</span>
<span class="cm">        * @return {Node}</span>
<span class="cm">        */</span>
        <span class="nx">removeCursor</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">keep</span><span class="p">)</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">cur</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getCursor</span><span class="p">();</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">cur</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">if</span> <span class="p">(</span><span class="nx">keep</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">cur</span><span class="p">.</span><span class="nx">removeAttribute</span><span class="p">(</span><span class="s1">&#39;id&#39;</span><span class="p">);</span>
                    <span class="nx">cur</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">&#39;innerHTML&#39;</span><span class="p">,</span> <span class="s1">&#39;&lt;br class=&quot;yui-cursor&quot;&gt;&#39;</span><span class="p">);</span>
                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">cur</span><span class="p">.</span><span class="nx">remove</span><span class="p">();</span>
                <span class="p">}</span>
            <span class="p">}</span>
            <span class="k">return</span> <span class="nx">cur</span><span class="p">;</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Gets a stored cursor and focuses it for editing, must be called sometime after setCursor</span>
<span class="cm">        * @method focusCursor</span>
<span class="cm">        * @return {Node}</span>
<span class="cm">        */</span>
        <span class="nx">focusCursor</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">collapse</span><span class="p">,</span> <span class="nx">end</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">collapse</span> <span class="o">!==</span> <span class="kc">false</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">collapse</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">end</span> <span class="o">!==</span> <span class="kc">false</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">end</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="kd">var</span> <span class="nx">cur</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">removeCursor</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">cur</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">cur</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">c</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">selectNode</span><span class="p">(</span><span class="nx">c</span><span class="p">,</span> <span class="nx">collapse</span><span class="p">,</span> <span class="nx">end</span><span class="p">);</span>
                <span class="p">},</span> <span class="k">this</span><span class="p">);</span>
            <span class="p">}</span>
        <span class="p">},</span>
        <span class="cm">/**</span>
<span class="cm">        * Generic toString for logging.</span>
<span class="cm">        * @method toString</span>
<span class="cm">        * @return {String}</span>
<span class="cm">        */</span>
        <span class="nx">toString</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="k">return</span> <span class="s1">&#39;Selection Object&#39;</span><span class="p">;</span>
        <span class="p">}</span>
    <span class="p">};</span>
</pre></div>

                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div id="moduleList" class="module">
                        <h4>Modules</h4>
                        <ul class="content">
                                <li class=""><a href="module_align-plugin.html" title="align-plugin">align-plugin</a></li>
                                <li class=""><a href="module_anim.html" title="anim">anim</a></li>
                                <li class=""><a href="module_arraysort.html" title="arraysort">arraysort</a></li>
                                <li class=""><a href="module_async-queue.html" title="async-queue">async-queue</a></li>
                                <li class=""><a href="module_attribute.html" title="attribute">attribute</a></li>
                                <li class=""><a href="module_autocomplete.html" title="autocomplete">autocomplete</a></li>
                                <li class=""><a href="module_base.html" title="base">base</a></li>
                                <li class=""><a href="module_cache.html" title="cache">cache</a></li>
                                <li class=""><a href="module_charts.html" title="charts">charts</a></li>
                                <li class=""><a href="module_classnamemanager.html" title="classnamemanager">classnamemanager</a></li>
                                <li class=""><a href="module_collection.html" title="collection">collection</a></li>
                                <li class=""><a href="module_console.html" title="console">console</a></li>
                                <li class=""><a href="module_console-filters.html" title="console-filters">console-filters</a></li>
                                <li class=""><a href="module_cookie.html" title="cookie">cookie</a></li>
                                <li class=""><a href="module_dataschema.html" title="dataschema">dataschema</a></li>
                                <li class=""><a href="module_datasource.html" title="datasource">datasource</a></li>
                                <li class=""><a href="module_datatable.html" title="datatable">datatable</a></li>
                                <li class=""><a href="module_datatype.html" title="datatype">datatype</a></li>
                                <li class=""><a href="module_dd.html" title="dd">dd</a></li>
                                <li class=""><a href="module_dial.html" title="dial">dial</a></li>
                                <li class=""><a href="module_dom.html" title="dom">dom</a></li>
                                <li class=""><a href="module_dump.html" title="dump">dump</a></li>
                                <li class="selected"><a href="module_editor.html" title="editor">editor</a></li>
                                <li class=""><a href="module_escape.html" title="escape">escape</a></li>
                                <li class=""><a href="module_event.html" title="event">event</a></li>
                                <li class=""><a href="module_event-custom.html" title="event-custom">event-custom</a></li>
                                <li class=""><a href="module_event-gestures.html" title="event-gestures">event-gestures</a></li>
                                <li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li>
                                <li class=""><a href="module_event-touch.html" title="event-touch">event-touch</a></li>
                                <li class=""><a href="module_event-valuechange.html" title="event-valuechange">event-valuechange</a></li>
                                <li class=""><a href="module_highlight.html" title="highlight">highlight</a></li>
                                <li class=""><a href="module_history.html" title="history">history</a></li>
                                <li class=""><a href="module_history-deprecated.html" title="history-deprecated">history-deprecated</a></li>
                                <li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li>
                                <li class=""><a href="module_intl.html" title="intl">intl</a></li>
                                <li class=""><a href="module_io.html" title="io">io</a></li>
                                <li class=""><a href="module_json.html" title="json">json</a></li>
                                <li class=""><a href="module_jsonp.html" title="jsonp">jsonp</a></li>
                                <li class=""><a href="module_loader.html" title="loader">loader</a></li>
                                <li class=""><a href="module_node.html" title="node">node</a></li>
                                <li class=""><a href="module_node-flick.html" title="node-flick">node-flick</a></li>
                                <li class=""><a href="module_node-focusmanager.html" title="node-focusmanager">node-focusmanager</a></li>
                                <li class=""><a href="module_node-menunav.html" title="node-menunav">node-menunav</a></li>
                                <li class=""><a href="module_oop.html" title="oop">oop</a></li>
                                <li class=""><a href="module_overlay.html" title="overlay">overlay</a></li>
                                <li class=""><a href="module_plugin.html" title="plugin">plugin</a></li>
                                <li class=""><a href="module_pluginhost.html" title="pluginhost">pluginhost</a></li>
                                <li class=""><a href="module_pluginhost-base.html" title="pluginhost-base">pluginhost-base</a></li>
                                <li class=""><a href="module_profiler.html" title="profiler">profiler</a></li>
                                <li class=""><a href="module_querystring.html" title="querystring">querystring</a></li>
                                <li class=""><a href="module_queue-promote.html" title="queue-promote">queue-promote</a></li>
                                <li class=""><a href="module_recordset.html" title="recordset">recordset</a></li>
                                <li class=""><a href="module_resize.html" title="resize">resize</a></li>
                                <li class=""><a href="module_scrollview.html" title="scrollview">scrollview</a></li>
                                <li class=""><a href="module_scrollview-base.html" title="scrollview-base">scrollview-base</a></li>
                                <li class=""><a href="module_scrollview-base-ie.html" title="scrollview-base-ie">scrollview-base-ie</a></li>
                                <li class=""><a href="module_scrollview-paginator.html" title="scrollview-paginator">scrollview-paginator</a></li>
                                <li class=""><a href="module_scrollview-scrollbars.html" title="scrollview-scrollbars">scrollview-scrollbars</a></li>
                                <li class=""><a href="module_shim-plugin.html" title="shim-plugin">shim-plugin</a></li>
                                <li class=""><a href="module_slider.html" title="slider">slider</a></li>
                                <li class=""><a href="module_sortable.html" title="sortable">sortable</a></li>
                                <li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li>
                                <li class=""><a href="module_substitute.html" title="substitute">substitute</a></li>
                                <li class=""><a href="module_swf.html" title="swf">swf</a></li>
                                <li class=""><a href="module_swfdetect.html" title="swfdetect">swfdetect</a></li>
                                <li class=""><a href="module_tabview.html" title="tabview">tabview</a></li>
                                <li class=""><a href="module_test.html" title="test">test</a></li>
                                <li class=""><a href="module_text.html" title="text">text</a></li>
                                <li class=""><a href="module_transition.html" title="transition">transition</a></li>
                                <li class=""><a href="module_uploader.html" title="uploader">uploader</a></li>
                                <li class=""><a href="module_widget.html" title="widget">widget</a></li>
                                <li class=""><a href="module_widget-anim.html" title="widget-anim">widget-anim</a></li>
                                <li class=""><a href="module_widget-base-ie.html" title="widget-base-ie">widget-base-ie</a></li>
                                <li class=""><a href="module_widget-child.html" title="widget-child">widget-child</a></li>
                                <li class=""><a href="module_widget-locale.html" title="widget-locale">widget-locale</a></li>
                                <li class=""><a href="module_widget-parent.html" title="widget-parent">widget-parent</a></li>
                                <li class=""><a href="module_widget-position.html" title="widget-position">widget-position</a></li>
                                <li class=""><a href="module_widget-position-align.html" title="widget-position-align">widget-position-align</a></li>
                                <li class=""><a href="module_widget-position-constrain.html" title="widget-position-constrain">widget-position-constrain</a></li>
                                <li class=""><a href="module_widget-stack.html" title="widget-stack">widget-stack</a></li>
                                <li class=""><a href="module_widget-stdmod.html" title="widget-stdmod">widget-stdmod</a></li>
                                <li class=""><a href="module_yql.html" title="yql">yql</a></li>
                                <li class=""><a href="module_yui.html" title="yui">yui</a></li>
                        </ul>
                    </div>

                    <div id="classList" class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="EditorBase.html" title="EditorBase">EditorBase</a></li>
                                <li class=""><a href="Frame.html" title="Frame">Frame</a></li>
                                <li class=""><a href="Plugin.CreateLinkBase.html" title="Plugin.CreateLinkBase">Plugin.CreateLinkBase</a></li>
                                <li class=""><a href="Plugin.EditorBidi.html" title="Plugin.EditorBidi">Plugin.EditorBidi</a></li>
                                <li class=""><a href="Plugin.EditorBR.html" title="Plugin.EditorBR">Plugin.EditorBR</a></li>
                                <li class=""><a href="Plugin.EditorLists.html" title="Plugin.EditorLists">Plugin.EditorLists</a></li>
                                <li class=""><a href="Plugin.EditorPara.html" title="Plugin.EditorPara">Plugin.EditorPara</a></li>
                                <li class=""><a href="Plugin.EditorTab.html" title="Plugin.EditorTab">Plugin.EditorTab</a></li>
                                <li class=""><a href="Plugin.ExecCommand.html" title="Plugin.ExecCommand">Plugin.ExecCommand</a></li>
                                <li class=""><a href="Selection.html" title="Selection">Selection</a></li>
                        </ul>
                    </div>

                    <div id="fileList" class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="createlink-base.js.html" title="createlink-base.js">createlink-base.js</a></li>
                                <li class=""><a href="editor-base.js.html" title="editor-base.js">editor-base.js</a></li>
                                <li class=""><a href="editor-bidi.js.html" title="editor-bidi.js">editor-bidi.js</a></li>
                                <li class=""><a href="editor-br.js.html" title="editor-br.js">editor-br.js</a></li>
                                <li class=""><a href="editor-para.js.html" title="editor-para.js">editor-para.js</a></li>
                                <li class=""><a href="editor-tab.js.html" title="editor-tab.js">editor-tab.js</a></li>
                                <li class=""><a href="exec-command.js.html" title="exec-command.js">exec-command.js</a></li>
                                <li class=""><a href="frame.js.html" title="frame.js">frame.js</a></li>
                                <li class=""><a href="lists.js.html" title="lists.js">lists.js</a></li>
                                <li class="selected"><a href="selection.js.html" title="selection.js">selection.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2011 Yahoo! Inc. All rights reserved.
	</div>
</div>
<script type="text/javascript">

    var ALL_YUI_PROPS = [{"access": "", "host": "Plugin.EditorBidi", "name": "addParents", "url": "Plugin.EditorBidi.html#method_addParents", "type": "method"}, {"access": "private", "host": "Plugin.EditorPara", "name": "_afterContentChange", "url": "Plugin.EditorPara.html#method__afterContentChange", "type": "method"}, {"access": "private", "host": "Plugin.EditorBR", "name": "_afterEditorReady", "url": "Plugin.EditorBR.html#method__afterEditorReady", "type": "method"}, {"access": "private", "host": "Plugin.EditorPara", "name": "_afterEditorReady", "url": "Plugin.EditorPara.html#method__afterEditorReady", "type": "method"}, {"access": "private", "host": "EditorBase", "name": "_afterFrameReady", "url": "EditorBase.html#method__afterFrameReady", "type": "method"}, {"access": "private", "host": "Plugin.EditorBidi", "name": "_afterMouseUp", "url": "Plugin.EditorBidi.html#method__afterMouseUp", "type": "method"}, {"access": "private", "host": "Plugin.EditorBidi", "name": "_afterNodeChange", "url": "Plugin.EditorBidi.html#method__afterNodeChange", "type": "method"}, {"access": "private", "host": "Plugin.EditorPara", "name": "_afterPaste", "url": "Plugin.EditorPara.html#method__afterPaste", "type": "method"}, {"access": "", "host": "Selection", "name": "ALL", "url": "Selection.html#property_ALL", "type": "property"}, {"access": "", "host": "Selection", "name": "anchorNode", "url": "Selection.html#property_anchorNode", "type": "property"}, {"access": "", "host": "Selection", "name": "anchorOffset", "url": "Selection.html#property_anchorOffset", "type": "property"}, {"access": "", "host": "Selection", "name": "anchorTextNode", "url": "Selection.html#property_anchorTextNode", "type": "property"}, {"access": "", "host": "Frame", "name": "basehref", "url": "Frame.html#config_basehref", "type": "config"}, {"access": "", "host": "Frame", "name": "basehrefChange", "url": "Frame.html#event_basehrefChange", "type": "event"}, {"access": "private", "host": "EditorBase", "name": "_beforeFrameDeactivate", "url": "EditorBase.html#method__beforeFrameDeactivate", "type": "method"}, {"access": "", "host": "Plugin.EditorBidi", "name": "blockParent", "url": "Plugin.EditorBidi.html#method_blockParent", "type": "method"}, {"access": "", "host": "Plugin.EditorBidi", "name": "BLOCKS", "url": "Plugin.EditorBidi.html#property_BLOCKS", "type": "property"}, {"access": "", "host": "Selection", "name": "BLOCKS", "url": "Selection.html#property_BLOCKS", "type": "property"}, {"access": "", "host": "EditorBase", "name": "bq", "url": "EditorBase.html#property_bq", "type": "property"}, {"access": "private", "host": "Plugin.EditorBidi", "name": "_checkForChange", "url": "Plugin.EditorBidi.html#method__checkForChange", "type": "method"}, {"access": "", "host": "Selection", "name": "cleanCursor", "url": "Selection.html#method_cleanCursor", "type": "method"}, {"access": "private", "host": "Plugin.ExecCommand", "name": "_command", "url": "Plugin.ExecCommand.html#method__command", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "command", "url": "Plugin.ExecCommand.html#method_command", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS", "url": "Plugin.ExecCommand.html#property_COMMANDS", "type": "property"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.addclass", "url": "Plugin.ExecCommand.html#method_COMMANDS.addclass", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.backcolor", "url": "Plugin.ExecCommand.html#method_COMMANDS.backcolor", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.bidi", "url": "Plugin.ExecCommand.html#property_COMMANDS.bidi", "type": "property"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.fontname", "url": "Plugin.ExecCommand.html#method_COMMANDS.fontname", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.fontsize", "url": "Plugin.ExecCommand.html#method_COMMANDS.fontsize", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.forecolor", "url": "Plugin.ExecCommand.html#method_COMMANDS.forecolor", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.hilitecolor", "url": "Plugin.ExecCommand.html#method_COMMANDS.hilitecolor", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.insertandfocus", "url": "Plugin.ExecCommand.html#method_COMMANDS.insertandfocus", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.insertbr", "url": "Plugin.ExecCommand.html#method_COMMANDS.insertbr", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.inserthtml", "url": "Plugin.ExecCommand.html#method_COMMANDS.inserthtml", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.insertimage", "url": "Plugin.ExecCommand.html#method_COMMANDS.insertimage", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.removeclass", "url": "Plugin.ExecCommand.html#method_COMMANDS.removeclass", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "COMMANDS.wrap", "url": "Plugin.ExecCommand.html#method_COMMANDS.wrap", "type": "method"}, {"access": "", "host": "Frame", "name": "container", "url": "Frame.html#config_container", "type": "config"}, {"access": "", "host": "Frame", "name": "containerChange", "url": "Frame.html#event_containerChange", "type": "event"}, {"access": "", "host": "EditorBase", "name": "content", "url": "EditorBase.html#config_content", "type": "config"}, {"access": "", "host": "Frame", "name": "content", "url": "Frame.html#config_content", "type": "config"}, {"access": "", "host": "EditorBase", "name": "contentChange", "url": "EditorBase.html#event_contentChange", "type": "event"}, {"access": "", "host": "Frame", "name": "contentChange", "url": "Frame.html#event_contentChange", "type": "event"}, {"access": "", "host": "EditorBase", "name": "copyStyles", "url": "EditorBase.html#method_copyStyles", "type": "method"}, {"access": "private", "host": "Frame", "name": "_create", "url": "Frame.html#method__create", "type": "method"}, {"access": "", "host": "Selection", "name": "createRange", "url": "Selection.html#method_createRange", "type": "method"}, {"access": "private", "host": "EditorBase", "name": "_currentSelection", "url": "EditorBase.html#property__currentSelection", "type": "property"}, {"access": "private", "host": "EditorBase", "name": "_currentSelectionClear", "url": "EditorBase.html#property__currentSelectionClear", "type": "property"}, {"access": "private", "host": "EditorBase", "name": "_currentSelectionTimer", "url": "EditorBase.html#property__currentSelectionTimer", "type": "property"}, {"access": "", "host": "Selection", "name": "CURSOR", "url": "Selection.html#property_CURSOR", "type": "property"}, {"access": "", "host": "Selection", "name": "CUR_WRAPID", "url": "Selection.html#property_CUR_WRAPID", "type": "property"}, {"access": "", "host": "Plugin.EditorPara", "name": "d", "url": "Plugin.EditorPara.html#property_d", "type": "property"}, {"access": "", "host": "Plugin.CreateLinkBase", "name": "DEFAULT", "url": "Plugin.CreateLinkBase.html#property_DEFAULT", "type": "property"}, {"access": "", "host": "EditorBase", "name": "defaultblock", "url": "EditorBase.html#config_defaultblock", "type": "config"}, {"access": "", "host": "Frame", "name": "defaultblock", "url": "Frame.html#config_defaultblock", "type": "config"}, {"access": "", "host": "EditorBase", "name": "defaultblockChange", "url": "EditorBase.html#event_defaultblockChange", "type": "event"}, {"access": "", "host": "Frame", "name": "defaultblockChange", "url": "Frame.html#event_defaultblockChange", "type": "event"}, {"access": "", "host": "Frame", "name": "DEFAULT_CSS", "url": "Frame.html#property_DEFAULT_CSS", "type": "property"}, {"access": "", "host": "Selection", "name": "DEFAULT_TAG", "url": "Selection.html#property_DEFAULT_TAG", "type": "property"}, {"access": "private", "host": "EditorBase", "name": "_defNodeChangeFn", "url": "EditorBase.html#method__defNodeChangeFn", "type": "method"}, {"access": "private", "host": "Frame", "name": "_defReadyFn", "url": "Frame.html#method__defReadyFn", "type": "method"}, {"access": "", "host": "Frame", "name": "delegate", "url": "Frame.html#method_delegate", "type": "method"}, {"access": "", "host": "Frame", "name": "designMode", "url": "Frame.html#config_designMode", "type": "config"}, {"access": "", "host": "Frame", "name": "designModeChange", "url": "Frame.html#event_designModeChange", "type": "event"}, {"access": "", "host": "EditorBase", "name": "dir", "url": "EditorBase.html#config_dir", "type": "config"}, {"access": "", "host": "Frame", "name": "dir", "url": "Frame.html#config_dir", "type": "config"}, {"access": "", "host": "EditorBase", "name": "dirChange", "url": "EditorBase.html#event_dirChange", "type": "event"}, {"access": "", "host": "Frame", "name": "dirChange", "url": "Frame.html#event_dirChange", "type": "event"}, {"access": "", "host": "Plugin.EditorBidi", "name": "DIV_WRAPPER", "url": "Plugin.EditorBidi.html#property_DIV_WRAPPER", "type": "property"}, {"access": "", "host": "Frame", "name": "DOC_TYPE", "url": "Frame.html#property_DOC_TYPE", "type": "property"}, {"access": "", "host": "Frame", "name": "DOM_EVENTS", "url": "Frame.html#property_DOM_EVENTS", "type": "property"}, {"access": "private", "host": "Frame", "name": "_DOMPaste", "url": "Frame.html#method__DOMPaste", "type": "method"}, {"access": "", "host": "Plugin.EditorBidi", "name": "EVENTS", "url": "Plugin.EditorBidi.html#property_EVENTS", "type": "property"}, {"access": "", "host": "EditorBase", "name": "execCommand", "url": "EditorBase.html#method_execCommand", "type": "method"}, {"access": "", "host": "EditorBase", "name": "extracss", "url": "EditorBase.html#config_extracss", "type": "config"}, {"access": "", "host": "Frame", "name": "extracss", "url": "Frame.html#config_extracss", "type": "config"}, {"access": "", "host": "EditorBase", "name": "extracssChange", "url": "EditorBase.html#event_extracssChange", "type": "event"}, {"access": "", "host": "Frame", "name": "extracssChange", "url": "Frame.html#event_extracssChange", "type": "event"}, {"access": "", "host": "Selection", "name": "filter", "url": "Selection.html#method_filter", "type": "method"}, {"access": "", "host": "Selection", "name": "filterBlocks", "url": "Selection.html#method_filterBlocks", "type": "method"}, {"access": "", "host": "EditorBase", "name": "FILTER_RGB", "url": "EditorBase.html#method_FILTER_RGB", "type": "method"}, {"access": "private", "host": "Plugin.EditorBidi", "name": "firstEvent", "url": "Plugin.EditorBidi.html#property_firstEvent", "type": "property"}, {"access": "private", "host": "Plugin.EditorPara", "name": "_fixFirstPara", "url": "Plugin.EditorPara.html#method__fixFirstPara", "type": "method"}, {"access": "private", "host": "Frame", "name": "_fixIECursors", "url": "Frame.html#method__fixIECursors", "type": "method"}, {"access": "protected", "host": "Plugin.ExecCommand", "name": "fixIETags", "url": "Plugin.ExecCommand.html#method_fixIETags", "type": "method"}, {"access": "", "host": "EditorBase", "name": "focus", "url": "EditorBase.html#method_focus", "type": "method"}, {"access": "", "host": "Frame", "name": "focus", "url": "Frame.html#method_focus", "type": "method"}, {"access": "", "host": "Selection", "name": "focusCursor", "url": "Selection.html#method_focusCursor", "type": "method"}, {"access": "", "host": "Selection", "name": "focusNode", "url": "Selection.html#property_focusNode", "type": "property"}, {"access": "", "host": "Selection", "name": "focusOffset", "url": "Selection.html#property_focusOffset", "type": "property"}, {"access": "", "host": "Selection", "name": "focusTextNode", "url": "Selection.html#property_focusTextNode", "type": "property"}, {"access": "", "host": "EditorBase", "name": "frame", "url": "EditorBase.html#property_frame", "type": "property"}, {"access": "", "host": "EditorBase", "name": "getContent", "url": "EditorBase.html#method_getContent", "type": "method"}, {"access": "", "host": "Selection", "name": "getCursor", "url": "Selection.html#method_getCursor", "type": "method"}, {"access": "", "host": "Frame", "name": "getDocType", "url": "Frame.html#method_getDocType", "type": "method"}, {"access": "", "host": "EditorBase", "name": "getDomPath", "url": "EditorBase.html#method_getDomPath", "type": "method"}, {"access": "private", "host": "Frame", "name": "_getHTML", "url": "Frame.html#method__getHTML", "type": "method"}, {"access": "", "host": "EditorBase", "name": "getInstance", "url": "EditorBase.html#method_getInstance", "type": "method"}, {"access": "", "host": "Plugin.ExecCommand", "name": "getInstance", "url": "Plugin.ExecCommand.html#method_getInstance", "type": "method"}, {"access": "", "host": "Frame", "name": "getInstance", "url": "Frame.html#method_getInstance", "type": "method"}, {"access": "", "host": "Selection", "name": "getSelected", "url": "Selection.html#method_getSelected", "type": "method"}, {"access": "", "host": "Selection", "name": "getText", "url": "Selection.html#method_getText", "type": "method"}, {"access": "private", "host": "Frame", "name": "_handleFocus", "url": "Frame.html#method__handleFocus", "type": "method"}, {"access": "", "host": "EditorBase", "name": "hide", "url": "EditorBase.html#method_hide", "type": "method"}, {"access": "", "host": "Frame", "name": "hide", "url": "Frame.html#method_hide", "type": "method"}, {"access": "", "host": "Frame", "name": "host", "url": "Frame.html#config_host", "type": "config"}, {"access": "", "host": "Frame", "name": "hostChange", "url": "Frame.html#event_hostChange", "type": "event"}, {"access": "", "host": "Frame", "name": "HTML", "url": "Frame.html#property_HTML", "type": "property"}, {"access": "", "host": "Frame", "name": "id", "url": "Frame.html#config_id", "type": "config"}, {"access": "", "host": "Frame", "name": "idChange", "url": "Frame.html#event_idChange", "type": "event"}, {"access": "private", "host": "Frame", "name": "_iframe", "url": "Frame.html#property__iframe", "type": "property"}, {"access": "", "host": "Selection", "name": "insertAtCursor", "url": "Selection.html#method_insertAtCursor", "type": "method"}, {"access": "", "host": "Selection", "name": "insertContent", "url": "Selection.html#method_insertContent", "type": "method"}, {"access": "", "host": "Plugin.EditorBR", "name": "inst", "url": "Plugin.EditorBR.html#property_inst", "type": "property"}, {"access": "private", "host": "Plugin.ExecCommand", "name": "_inst", "url": "Plugin.ExecCommand.html#property__inst", "type": "property"}, {"access": "private", "host": "Frame", "name": "_instance", "url": "Frame.html#property__instance", "type": "property"}, {"access": "private", "host": "Frame", "name": "_instanceLoaded", "url": "Frame.html#method__instanceLoaded", "type": "method"}, {"access": "", "host": "Selection", "name": "isCollapsed", "url": "Selection.html#property_isCollapsed", "type": "property"}, {"access": "", "host": "Frame", "name": "lang", "url": "Frame.html#config_lang", "type": "config"}, {"access": "", "host": "Frame", "name": "langChange", "url": "Frame.html#event_langChange", "type": "event"}, {"access": "private", "host": "EditorBase", "name": "_lastBookmark", "url": "EditorBase.html#property__lastBookmark", "type": "property"}, {"access": "private", "host": "Plugin.EditorBidi", "name": "lastDirection", "url": "Plugin.EditorBidi.html#property_lastDirection", "type": "property"}, {"access": "private", "host": "Plugin.ExecCommand", "name": "_lastKey", "url": "Plugin.ExecCommand.html#property__lastKey", "type": "property"}, {"access": "", "host": "EditorBase", "name": "linkedcss", "url": "EditorBase.html#config_linkedcss", "type": "config"}, {"access": "", "host": "Frame", "name": "linkedcss", "url": "Frame.html#config_linkedcss", "type": "config"}, {"access": "", "host": "EditorBase", "name": "linkedcssChange", "url": "EditorBase.html#event_linkedcssChange", "type": "event"}, {"access": "", "host": "Frame", "name": "linkedcssChange", "url": "Frame.html#event_linkedcssChange", "type": "event"}, {"access": "", "host": "Frame", "name": "META", "url": "Frame.html#property_META", "type": "property"}, {"access": "", "host": "EditorBase", "name": "NAME", "url": "EditorBase.html#property_NAME", "type": "property"}, {"access": "", "host": "Plugin.EditorBidi", "name": "NAME", "url": "Plugin.EditorBidi.html#property_NAME", "type": "property"}, {"access": "", "host": "Plugin.EditorBR", "name": "NAME", "url": "Plugin.EditorBR.html#property_NAME", "type": "property"}, {"access": "", "host": "Plugin.EditorPara", "name": "NAME", "url": "Plugin.EditorPara.html#property_NAME", "type": "property"}, {"access": "", "host": "Plugin.EditorTab", "name": "NAME", "url": "Plugin.EditorTab.html#property_NAME", "type": "property"}, {"access": "", "host": "Plugin.ExecCommand", "name": "NAME", "url": "Plugin.ExecCommand.html#property_NAME", "type": "property"}, {"access": "", "host": "Frame", "name": "NAME", "url": "Frame.html#property_NAME", "type": "property"}, {"access": "", "host": "Plugin.EditorLists", "name": "NAME", "url": "Plugin.EditorLists.html#property_NAME", "type": "property"}, {"access": "", "host": "EditorBase", "name": "NC_KEYS", "url": "EditorBase.html#property_NC_KEYS", "type": "property"}, {"access": "", "host": "Frame", "name": "node", "url": "Frame.html#config_node", "type": "config"}, {"access": "", "host": "EditorBase", "name": "nodeChange", "url": "EditorBase.html#event_nodeChange", "type": "event"}, {"access": "", "host": "Frame", "name": "nodeChange", "url": "Frame.html#event_nodeChange", "type": "event"}, {"access": "", "host": "Plugin.EditorBidi", "name": "_NODE_SELECTED", "url": "Plugin.EditorBidi.html#property__NODE_SELECTED", "type": "property"}, {"access": "", "host": "Plugin.EditorLists", "name": "NONSEL", "url": "Plugin.EditorLists.html#property_NONSEL", "type": "property"}, {"access": "", "host": "EditorBase", "name": "NORMALIZE_FONTSIZE", "url": "EditorBase.html#method_NORMALIZE_FONTSIZE", "type": "method"}, {"access": "", "host": "Plugin.EditorBidi", "name": "NS", "url": "Plugin.EditorBidi.html#property_NS", "type": "property"}, {"access": "", "host": "Plugin.EditorBR", "name": "NS", "url": "Plugin.EditorBR.html#property_NS", "type": "property"}, {"access": "", "host": "Plugin.EditorPara", "name": "NS", "url": "Plugin.EditorPara.html#property_NS", "type": "property"}, {"access": "", "host": "Plugin.EditorTab", "name": "NS", "url": "Plugin.EditorTab.html#property_NS", "type": "property"}, {"access": "", "host": "Plugin.ExecCommand", "name": "NS", "url": "Plugin.ExecCommand.html#property_NS", "type": "property"}, {"access": "", "host": "Plugin.EditorLists", "name": "NS", "url": "Plugin.EditorLists.html#property_NS", "type": "property"}, {"access": "private", "host": "Frame", "name": "_onContentReady", "url": "Frame.html#method__onContentReady", "type": "method"}, {"access": "private", "host": "Frame", "name": "_onDomEvent", "url": "Frame.html#method__onDomEvent", "type": "method"}, {"access": "private", "host": "EditorBase", "name": "_onFrameActivate", "url": "EditorBase.html#method__onFrameActivate", "type": "method"}, {"access": "private", "host": "EditorBase", "name": "_onFrameKeyDown", "url": "EditorBase.html#method__onFrameKeyDown", "type": "method"}, {"access": "private", "host": "EditorBase", "name": "_onFrameKeyPress", "url": "EditorBase.html#method__onFrameKeyPress", "type": "method"}, {"access": "private", "host": "EditorBase", "name": "_onFrameKeyUp", "url": "EditorBase.html#method__onFrameKeyUp", "type": "method"}, {"access": "private", "host": "EditorBase", "name": "_onFrameMouseDown", "url": "EditorBase.html#method__onFrameMouseDown", "type": "method"}, {"access": "private", "host": "EditorBase", "name": "_onFrameMouseUp", "url": "EditorBase.html#method__onFrameMouseUp", "type": "method"}, {"access": "private", "host": "Plugin.EditorBR", "name": "_onKeyDown", "url": "Plugin.EditorBR.html#method__onKeyDown", "type": "method"}, {"access": "private", "host": "Plugin.EditorBR", "name": "_onNodeChange", "url": "Plugin.EditorBR.html#method__onNodeChange", "type": "method"}, {"access": "private", "host": "Plugin.EditorPara", "name": "_onNodeChange", "url": "Plugin.EditorPara.html#method__onNodeChange", "type": "method"}, {"access": "private", "host": "Plugin.EditorTab", "name": "_onNodeChange", "url": "Plugin.EditorTab.html#method__onNodeChange", "type": "method"}, {"access": "private", "host": "Plugin.EditorLists", "name": "_onNodeChange", "url": "Plugin.EditorLists.html#method__onNodeChange", "type": "method"}, {"access": "", "host": "Frame", "name": "PAGE_HTML", "url": "Frame.html#property_PAGE_HTML", "type": "property"}, {"access": "", "host": "Plugin.CreateLinkBase", "name": "PROMPT", "url": "Plugin.CreateLinkBase.html#property_PROMPT", "type": "property"}, {"access": "", "host": "EditorBase", "name": "ready", "url": "EditorBase.html#event_ready", "type": "event"}, {"access": "private", "host": "Frame", "name": "_ready", "url": "Frame.html#property__ready", "type": "property"}, {"access": "", "host": "Selection", "name": "REG_CHAR", "url": "Selection.html#property_REG_CHAR", "type": "property"}, {"access": "", "host": "Selection", "name": "REG_NOHTML", "url": "Selection.html#property_REG_NOHTML", "type": "property"}, {"access": "", "host": "Selection", "name": "REG_NON", "url": "Selection.html#property_REG_NON", "type": "property"}, {"access": "", "host": "Plugin.EditorLists", "name": "REMOVE", "url": "Plugin.EditorLists.html#property_REMOVE", "type": "property"}, {"access": "", "host": "Selection", "name": "remove", "url": "Selection.html#method_remove", "type": "method"}, {"access": "", "host": "Selection", "name": "removeCursor", "url": "Selection.html#method_removeCursor", "type": "method"}, {"access": "", "host": "EditorBase", "name": "render", "url": "EditorBase.html#method_render", "type": "method"}, {"access": "", "host": "Frame", "name": "render", "url": "Frame.html#method_render", "type": "method"}, {"access": "private", "host": "Frame", "name": "_rendered", "url": "Frame.html#property__rendered", "type": "property"}, {"access": "", "host": "Selection", "name": "replace", "url": "Selection.html#method_replace", "type": "method"}, {"access": "", "host": "Selection", "name": "resolve", "url": "Selection.html#method_resolve", "type": "method"}, {"access": "private", "host": "Frame", "name": "_resolveBaseHref", "url": "Frame.html#method__resolveBaseHref", "type": "method"}, {"access": "private", "host": "EditorBase", "name": "_resolveChangedNode", "url": "EditorBase.html#method__resolveChangedNode", "type": "method"}, {"access": "private", "host": "Frame", "name": "_resolveWinDoc", "url": "Frame.html#method__resolveWinDoc", "type": "method"}, {"access": "private", "host": "Selection", "name": "_selection", "url": "Selection.html#property__selection", "type": "property"}, {"access": "", "host": "Selection", "name": "selectNode", "url": "Selection.html#method_selectNode", "type": "method"}, {"access": "", "host": "Selection", "name": "setCursor", "url": "Selection.html#method_setCursor", "type": "method"}, {"access": "private", "host": "Frame", "name": "_setExtraCSS", "url": "Frame.html#method__setExtraCSS", "type": "method"}, {"access": "private", "host": "Frame", "name": "_setHTML", "url": "Frame.html#method__setHTML", "type": "method"}, {"access": "private", "host": "Frame", "name": "_setLinkedCSS", "url": "Frame.html#method__setLinkedCSS", "type": "method"}, {"access": "", "host": "EditorBase", "name": "show", "url": "EditorBase.html#method_show", "type": "method"}, {"access": "", "host": "Frame", "name": "show", "url": "Frame.html#method_show", "type": "method"}, {"access": "", "host": "Frame", "name": "src", "url": "Frame.html#config_src", "type": "config"}, {"access": "", "host": "Frame", "name": "srcChange", "url": "Frame.html#event_srcChange", "type": "event"}, {"access": "", "host": "Plugin.CreateLinkBase", "name": "STRINGS", "url": "Plugin.CreateLinkBase.html#property_STRINGS", "type": "property"}, {"access": "", "host": "EditorBase", "name": "STRINGS", "url": "EditorBase.html#property_STRINGS", "type": "property"}, {"access": "", "host": "EditorBase", "name": "STRINGS.title", "url": "EditorBase.html#property_STRINGS.title", "type": "property"}, {"access": "private", "host": "Selection", "name": "_swap", "url": "Selection.html#method__swap", "type": "method"}, {"access": "", "host": "EditorBase", "name": "TABKEY", "url": "EditorBase.html#property_TABKEY", "type": "property"}, {"access": "", "host": "EditorBase", "name": "TAG2CMD", "url": "EditorBase.html#property_TAG2CMD", "type": "property"}, {"access": "", "host": "Selection", "name": "text", "url": "Selection.html#property_text", "type": "property"}, {"access": "", "host": "Frame", "name": "title", "url": "Frame.html#config_title", "type": "config"}, {"access": "", "host": "Frame", "name": "titleChange", "url": "Frame.html#event_titleChange", "type": "event"}, {"access": "", "host": "Selection", "name": "TMP", "url": "Selection.html#property_TMP", "type": "property"}, {"access": "", "host": "Selection", "name": "toString", "url": "Selection.html#method_toString", "type": "method"}, {"access": "", "host": "Selection", "name": "unfilter", "url": "Selection.html#method_unfilter", "type": "method"}, {"access": "", "host": "EditorBase", "name": "USE", "url": "EditorBase.html#property_USE", "type": "property"}, {"access": "", "host": "Frame", "name": "use", "url": "Frame.html#method_use", "type": "method"}, {"access": "", "host": "Frame", "name": "use", "url": "Frame.html#config_use", "type": "config"}, {"access": "", "host": "Frame", "name": "useChange", "url": "Frame.html#event_useChange", "type": "event"}, {"access": "private", "host": "Selection", "name": "_wrap", "url": "Selection.html#method__wrap", "type": "method"}, {"access": "private", "host": "Selection", "name": "_wrapBlock", "url": "Selection.html#method__wrapBlock", "type": "method"}, {"access": "", "host": "Selection", "name": "wrapContent", "url": "Selection.html#method_wrapContent", "type": "method"}];
</script>
</body>
</html>
